From f1f896364c902f8a07350813eeb8fafc62da3d21 Mon Sep 17 00:00:00 2001 From: Owen Kephart Date: Thu, 10 Oct 2024 15:52:54 -0700 Subject: [PATCH] [1.9] Update default value of allow_backfills to True --- .../definitions/automation_condition_sensor_definition.py | 4 ++-- .../declarative_automation/automation_context.py | 6 ------ .../definitions/backfill_simple_non_user_code.py | 6 +----- .../daemon_tests/definitions/backfill_simple_user_code.py | 4 +--- .../definitions/backfill_with_runs_and_checks.py | 4 +--- 5 files changed, 5 insertions(+), 19 deletions(-) diff --git a/python_modules/dagster/dagster/_core/definitions/automation_condition_sensor_definition.py b/python_modules/dagster/dagster/_core/definitions/automation_condition_sensor_definition.py index 7fa9bd28ab398..c4b135bd7beb5 100644 --- a/python_modules/dagster/dagster/_core/definitions/automation_condition_sensor_definition.py +++ b/python_modules/dagster/dagster/_core/definitions/automation_condition_sensor_definition.py @@ -93,7 +93,7 @@ class AutomationConditionSensorDefinition(SensorDefinition): the provided interval. description (Optional[str]): A human-readable description of the sensor. emit_backfills (bool): If set to True, will emit a backfill on any tick where more than one partition - of any single asset is requested, rather than individual runs. Defaults to False. + of any single asset is requested, rather than individual runs. Defaults to True. """ def __init__( @@ -107,7 +107,7 @@ def __init__( minimum_interval_seconds: Optional[int] = None, description: Optional[str] = None, metadata: Optional[Mapping[str, object]] = None, - emit_backfills: bool = False, + emit_backfills: bool = True, **kwargs, ): self._user_code = kwargs.get("user_code", False) diff --git a/python_modules/dagster/dagster/_core/definitions/declarative_automation/automation_context.py b/python_modules/dagster/dagster/_core/definitions/declarative_automation/automation_context.py index 6998e7d4a8259..940a11b4bafcd 100644 --- a/python_modules/dagster/dagster/_core/definitions/declarative_automation/automation_context.py +++ b/python_modules/dagster/dagster/_core/definitions/declarative_automation/automation_context.py @@ -21,7 +21,6 @@ StructuredCursor, ) from dagster._core.definitions.partition import PartitionsDefinition -from dagster._core.errors import DagsterInvalidDefinitionError from dagster._time import get_current_datetime if TYPE_CHECKING: @@ -69,11 +68,6 @@ def create(key: EntityKey, evaluator: "AutomationConditionEvaluator") -> "Automa ) condition_unqiue_id = condition.get_node_unique_id(parent_unique_id=None, index=None) - if condition.has_rule_condition and evaluator.emit_backfills: - raise DagsterInvalidDefinitionError( - "Cannot use AutoMaterializePolicies and request backfills. Please use AutomationCondition or set DECLARATIVE_AUTOMATION_REQUEST_BACKFILLS to False." - ) - return AutomationContext( condition=condition, condition_unique_id=condition_unqiue_id, diff --git a/python_modules/dagster/dagster_tests/definitions_tests/declarative_automation_tests/daemon_tests/definitions/backfill_simple_non_user_code.py b/python_modules/dagster/dagster_tests/definitions_tests/declarative_automation_tests/daemon_tests/definitions/backfill_simple_non_user_code.py index b67fe057aa786..19106cb47dff3 100644 --- a/python_modules/dagster/dagster_tests/definitions_tests/declarative_automation_tests/daemon_tests/definitions/backfill_simple_non_user_code.py +++ b/python_modules/dagster/dagster_tests/definitions_tests/declarative_automation_tests/daemon_tests/definitions/backfill_simple_non_user_code.py @@ -6,11 +6,7 @@ def get_defs() -> dg.Definitions: return dg.Definitions( assets=uc_defs.assets, - sensors=[ - dg.AutomationConditionSensorDefinition( - name="the_sensor", asset_selection="*", emit_backfills=True - ) - ], + sensors=[dg.AutomationConditionSensorDefinition(name="the_sensor", asset_selection="*")], ) diff --git a/python_modules/dagster/dagster_tests/definitions_tests/declarative_automation_tests/daemon_tests/definitions/backfill_simple_user_code.py b/python_modules/dagster/dagster_tests/definitions_tests/declarative_automation_tests/daemon_tests/definitions/backfill_simple_user_code.py index e6ef49d70954b..a09992573e5db 100644 --- a/python_modules/dagster/dagster_tests/definitions_tests/declarative_automation_tests/daemon_tests/definitions/backfill_simple_user_code.py +++ b/python_modules/dagster/dagster_tests/definitions_tests/declarative_automation_tests/daemon_tests/definitions/backfill_simple_user_code.py @@ -46,8 +46,6 @@ def E() -> None: ... defs = dg.Definitions( assets=[A, B, C, D, E], sensors=[ - dg.AutomationConditionSensorDefinition( - "the_sensor", asset_selection="*", user_code=True, emit_backfills=True - ) + dg.AutomationConditionSensorDefinition("the_sensor", asset_selection="*", user_code=True) ], ) diff --git a/python_modules/dagster/dagster_tests/definitions_tests/declarative_automation_tests/daemon_tests/definitions/backfill_with_runs_and_checks.py b/python_modules/dagster/dagster_tests/definitions_tests/declarative_automation_tests/daemon_tests/definitions/backfill_with_runs_and_checks.py index 5fef7bd8b596e..f57daaa6997ca 100644 --- a/python_modules/dagster/dagster_tests/definitions_tests/declarative_automation_tests/daemon_tests/definitions/backfill_with_runs_and_checks.py +++ b/python_modules/dagster/dagster_tests/definitions_tests/declarative_automation_tests/daemon_tests/definitions/backfill_with_runs_and_checks.py @@ -71,8 +71,6 @@ def outside2() -> dg.AssetCheckResult: ... assets=[backfillA, backfillB, backfillC, run1, run2], asset_checks=[outsideA, outsideB, outside1, outside2], sensors=[ - dg.AutomationConditionSensorDefinition( - "the_sensor", asset_selection="*", user_code=True, emit_backfills=True - ) + dg.AutomationConditionSensorDefinition("the_sensor", asset_selection="*", user_code=True) ], )