Skip to content

Commit

Permalink
Sum over gathered
Browse files Browse the repository at this point in the history
  • Loading branch information
briantu committed Oct 21, 2024
1 parent bf1725d commit c63f9ec
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ async def async_evaluate(
num_conditions = len(self.entity_keys)
num_evaluated = 0

async def _evaluate_entity_async(entity_key: EntityKey) -> None:
nonlocal num_evaluated

async def _evaluate_entity_async(entity_key: EntityKey) -> int:
self.logger.debug(
f"Evaluating {entity_key.to_user_string()} ({num_evaluated+1}/{num_conditions})"
)
Expand All @@ -138,15 +136,16 @@ async def _evaluate_entity_async(entity_key: EntityKey) -> None:
f"requested ({requested_str}) "
f"({format(result.end_timestamp - result.start_timestamp, '.3f')} seconds)"
)
num_evaluated += 1
return 1

for topo_level in self.asset_graph.toposorted_entity_keys_by_level:
coroutines = [
_evaluate_entity_async(entity_key)
for entity_key in topo_level
if entity_key in self.entity_keys
]
await asyncio.gather(*coroutines)
gathered = await asyncio.gather(*coroutines)
num_evaluated += sum(gathered)

return list(self.current_results_by_key.values()), [
v for v in self.request_subsets_by_key.values() if not v.is_empty
Expand Down

0 comments on commit c63f9ec

Please sign in to comment.