Declarative Automation: Operators
Operators combine operands and other conditions into complex expressions using boolean logic and transformations.
Boolean Operators
& (AND): Both conditions must be true:
import dagster as dg
condition = (
dg.AutomationCondition.newly_updated()
& ~dg.AutomationCondition.in_progress()
)
| (OR): Either condition must be true:
condition = (
dg.AutomationCondition.missing()
| dg.AutomationCondition.newly_updated()
)
~ (NOT): Negates the condition:
condition = ~dg.AutomationCondition.any_deps_missing()
Transformation Operators
since(reset_condition)
Converts events into status. Becomes true when the operand becomes true and remains true until the reset condition becomes true.
# True from when dependency updates until asset is requested
condition = dg.AutomationCondition.any_deps_updated().since(
dg.AutomationCondition.newly_requested()
)
Pattern: A.since(B) means "A has occurred more recently than B"
Use case: Create persistent states from transient events. "Upstream updated" is an event, but "upstream updated since I was last requested" is a status.
newly_true()
Converts status into an event. True only on the tick when the operand transitions from false to true.
# True only on the tick when the asset becomes missing
condition = dg.AutomationCondition.missing().newly_true()
Use case: Prevent repeated actions during persistent states. missing() stays true for many ticks, but missing().newly_true() is only true once.
since_last_handled()
Convenience method equivalent to .since(newly_requested() | newly_updated() | initial_evaluation()).
condition = dg.AutomationCondition.any_deps_updated().since_last_handled()
True from when the condition becomes true until the asset is requested, updated, or the condition is first applied.
Dependency Operators
any_deps_match(condition)
True if the condition is true for at least one partition of any upstream dependency.
condition = dg.AutomationCondition.any_deps_match(
dg.AutomationCondition.missing()
)
Supports filtering with .allow() and .ignore().
all_deps_match(condition)
True if the condition is true for at least one partition of all upstream dependencies.
condition = dg.AutomationCondition.all_deps_match(
dg.AutomationCondition.newly_updated()
)
Requires every upstream asset to have at least one partition matching the condition.
Dependency Filtering
allow(selection)
Restricts which dependencies are checked to only those in the AssetSelection:
# Only consider dependencies in the "important" group
condition = dg.AutomationCondition.any_deps_match(
dg.AutomationCondition.missing()
).allow(dg.AssetSelection.groups("important"))
Creates an intersection: dep_keys & allowed_selection
ignore(selection)
Excludes dependencies in the AssetSelection from being checked:
# Ignore the "foo" asset when checking for updates
condition = dg.AutomationCondition.any_deps_updated().ignore(
dg.AssetSelection.assets("foo")
)
Creates a subtraction: dep_keys - ignored_selection
Propagation Through Boolean Operators
When applied to AND/OR conditions, .allow() and .ignore() propagate to all sub-conditions:
# Applies allow() to all dependency checks within eager()
condition = dg.AutomationCondition.eager().allow(
dg.AssetSelection.groups("critical")
)
Check Operators
any_checks_match(condition, blocking_only)
True if any of the asset's checks match the condition.
condition = dg.AutomationCondition.any_checks_match(
dg.AutomationCondition.check_failed(),
blocking_only=True,
)
Parameters:
condition: Condition to evaluate against checksblocking_only(bool): If True, only considers blocking checks (default: False)
all_checks_match(condition, blocking_only)
True if all of the asset's checks match the condition.
condition = dg.AutomationCondition.all_checks_match(
dg.AutomationCondition.check_passed(),
blocking_only=True,
)
Labeling
with_label(label)
Adds a human-readable label to a condition for debugging and UI display:
condition = (
dg.AutomationCondition.any_deps_updated()
.since(dg.AutomationCondition.newly_requested())
).with_label("updated_since_requested")
Labels appear in condition evaluation traces in the Dagster UI, making complex conditions easier to understand.