-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[refactor] Move all operands into a single file
- Loading branch information
1 parent
791df56
commit ee98440
Showing
6 changed files
with
61 additions
and
57 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
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
6 changes: 2 additions & 4 deletions
6
python_modules/dagster/dagster/_core/definitions/declarative_automation/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
26 changes: 0 additions & 26 deletions
26
...gster/_core/definitions/declarative_automation/operands/code_version_changed_condition.py
This file was deleted.
Oops, something went wrong.
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
33 changes: 33 additions & 0 deletions
33
.../dagster/_core/definitions/declarative_automation/operands/subset_automation_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,33 @@ | ||
from abc import abstractmethod | ||
|
||
from dagster._core.asset_graph_view.entity_subset import EntitySubset | ||
from dagster._core.definitions.asset_key import T_EntityKey | ||
from dagster._core.definitions.declarative_automation.automation_condition import ( | ||
AutomationResult, | ||
BuiltinAutomationCondition, | ||
) | ||
from dagster._core.definitions.declarative_automation.automation_context import AutomationContext | ||
from dagster._record import record | ||
|
||
|
||
@record | ||
class SubsetAutomationCondition(BuiltinAutomationCondition[T_EntityKey]): | ||
"""Base class for simple conditions which compute a simple subset of the asset graph.""" | ||
|
||
@property | ||
def requires_cursor(self) -> bool: | ||
return False | ||
|
||
@abstractmethod | ||
def compute_subset( | ||
self, context: AutomationContext[T_EntityKey] | ||
) -> EntitySubset[T_EntityKey]: ... | ||
|
||
def evaluate(self, context: AutomationContext[T_EntityKey]) -> AutomationResult[T_EntityKey]: | ||
# don't compute anything if there are no candidates | ||
if context.candidate_subset.is_empty: | ||
true_subset = context.get_empty_subset() | ||
else: | ||
true_subset = self.compute_subset(context) | ||
|
||
return AutomationResult(context, true_subset) |