-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b9597c6
commit 1916393
Showing
8 changed files
with
144 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
python_modules/dagster/dagster/_core/definitions/declarative_scheduling/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
python_modules/dagster/dagster/_core/definitions/declarative_scheduling/operands/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
...s/definitions_tests/auto_materialize_tests/asset_condition_tests/test_failed_condition.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
from dagster import SchedulingCondition | ||
from dagster._core.definitions.asset_key import AssetKey | ||
from dagster._core.definitions.events import AssetKeyPartitionKey | ||
|
||
from ..base_scenario import run_request | ||
from ..scenario_specs import one_asset, two_partitions_def | ||
from .asset_condition_scenario import AssetConditionScenarioState | ||
|
||
|
||
def test_failed_unpartitioned() -> None: | ||
state = AssetConditionScenarioState(one_asset, asset_condition=SchedulingCondition.failed()) | ||
|
||
# no failed partitions | ||
state, result = state.evaluate("A") | ||
assert result.true_subset.size == 0 | ||
|
||
# now a partition fails | ||
state = state.with_failed_run_for_asset("A") | ||
state, result = state.evaluate("A") | ||
assert result.true_subset.size == 1 | ||
|
||
# the next run completes successfully | ||
state = state.with_runs(run_request("A")) | ||
_, result = state.evaluate("A") | ||
assert result.true_subset.size == 0 | ||
|
||
|
||
def test_in_progress_static_partitioned() -> None: | ||
state = AssetConditionScenarioState( | ||
one_asset, asset_condition=SchedulingCondition.failed() | ||
).with_asset_properties(partitions_def=two_partitions_def) | ||
|
||
# no failed_runs | ||
state, result = state.evaluate("A") | ||
assert result.true_subset.size == 0 | ||
|
||
# now one partition fails | ||
state = state.with_failed_run_for_asset("A", partition_key="1") | ||
state, result = state.evaluate("A") | ||
assert result.true_subset.size == 1 | ||
assert result.true_subset.asset_partitions == {AssetKeyPartitionKey(AssetKey("A"), "1")} | ||
|
||
# now that partition succeeds | ||
state = state.with_runs(run_request("A", partition_key="1")) | ||
state, result = state.evaluate("A") | ||
assert result.true_subset.size == 0 | ||
|
||
# now both partitions fail | ||
state = state.with_failed_run_for_asset( | ||
"A", | ||
partition_key="1", | ||
).with_failed_run_for_asset( | ||
"A", | ||
partition_key="2", | ||
) | ||
state, result = state.evaluate("A") | ||
assert result.true_subset.size == 2 | ||
|
||
# now both partitions succeed | ||
state = state.with_runs( | ||
run_request("A", partition_key="1"), | ||
run_request("A", partition_key="2"), | ||
) | ||
_, result = state.evaluate("A") | ||
assert result.true_subset.size == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters