Print debugging
Browse files
expand.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
from collections import defaultdict
|
2 |
from dataclasses import dataclass, field
|
|
|
3 |
from typing import Callable, Protocol, Self
|
4 |
|
5 |
@dataclass
|
@@ -87,7 +88,11 @@ def expand(batch: Batch, expander: BatchExpander, completion_criterion: Callable
|
|
87 |
while len(current_batch.items) > 0:
|
88 |
print(f"Expanding {len(current_batch.items)} series: {current_batch.items}")
|
89 |
current_batch_items = []
|
|
|
90 |
expanded = expander.expand(current_batch)
|
|
|
|
|
|
|
91 |
for item in expanded.items:
|
92 |
if len(item.expansions) == 0:
|
93 |
completed_series.append(item.series)
|
@@ -96,4 +101,5 @@ def expand(batch: Batch, expander: BatchExpander, completion_criterion: Callable
|
|
96 |
completed_series.extend(completed)
|
97 |
current_batch_items.extend(new_series)
|
98 |
current_batch = Batch(items=current_batch_items)
|
|
|
99 |
return compute_expansions(batch.items, completed_series)
|
|
|
1 |
from collections import defaultdict
|
2 |
from dataclasses import dataclass, field
|
3 |
+
import time
|
4 |
from typing import Callable, Protocol, Self
|
5 |
|
6 |
@dataclass
|
|
|
88 |
while len(current_batch.items) > 0:
|
89 |
print(f"Expanding {len(current_batch.items)} series: {current_batch.items}")
|
90 |
current_batch_items = []
|
91 |
+
start_time = time.time()
|
92 |
expanded = expander.expand(current_batch)
|
93 |
+
print(f"Expanded, took {time.time() - start_time} seconds")
|
94 |
+
print("Computing new batch")
|
95 |
+
start_time = time.time()
|
96 |
for item in expanded.items:
|
97 |
if len(item.expansions) == 0:
|
98 |
completed_series.append(item.series)
|
|
|
101 |
completed_series.extend(completed)
|
102 |
current_batch_items.extend(new_series)
|
103 |
current_batch = Batch(items=current_batch_items)
|
104 |
+
print(f"Computed, took {time.time() - start_time} seconds")
|
105 |
return compute_expansions(batch.items, completed_series)
|