Skip to content

Commit

Permalink
Gather since op results
Browse files Browse the repository at this point in the history
  • Loading branch information
briantu committed Oct 18, 2024
1 parent 4f00a63 commit 2757128
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from dagster._core.definitions.asset_key import AssetCheckKey, AssetKey, EntityKey, T_EntityKey
from dagster._core.definitions.declarative_automation.automation_condition import (
AutomationCondition,
AutomationResult,
)
from dagster._core.definitions.declarative_automation.legacy.legacy_context import (
LegacyRuleEvaluationContext,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import asyncio
from typing import Sequence

from dagster._core.definitions.asset_key import T_EntityKey
Expand Down Expand Up @@ -31,15 +32,17 @@ async def evaluate(
# must evaluate child condition over the entire subset to avoid missing state transitions
child_candidate_subset = context.asset_graph_view.get_full_subset(key=context.key)

# compute result for trigger condition
trigger_result = await context.for_child_condition(
self.trigger_condition, child_index=0, candidate_subset=child_candidate_subset
).evaluate_async()

# compute result for reset condition
reset_result = await context.for_child_condition(
self.reset_condition, child_index=1, candidate_subset=child_candidate_subset
).evaluate_async()
# compute result for trigger and reset conditions
trigger_result, reset_result = await asyncio.gather(
*[
context.for_child_condition(
self.trigger_condition, child_index=0, candidate_subset=child_candidate_subset
).evaluate_async(),
context.for_child_condition(
self.reset_condition, child_index=1, candidate_subset=child_candidate_subset
).evaluate_async(),
]
)

# take the previous subset that this was true for
true_subset = context.previous_true_subset or context.get_empty_subset()
Expand Down

0 comments on commit 2757128

Please sign in to comment.