From b37681593c9d5dc5fa8b1674fc989d2c231e79e3 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 af92af15dcad3..acfe22df38736 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 @@ -82,7 +82,7 @@ class AutomationConditionSensorDefinition(SensorDefinition): the provided interval. description (Optional[str]): A human-readable description of the sensor. allow_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__( @@ -96,7 +96,7 @@ def __init__( minimum_interval_seconds: Optional[int] = None, description: Optional[str] = None, metadata: Optional[Mapping[str, object]] = None, - allow_backfills: bool = False, + allow_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 67f3e0b87ec28..ac5405089dcb3 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 @@ -22,7 +22,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: @@ -70,11 +69,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.allow_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 65b0e0c9a7981..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="*", allow_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 19ebc54e08cd8..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, allow_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 e773ea17973d2..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, allow_backfills=True - ) + dg.AutomationConditionSensorDefinition("the_sensor", asset_selection="*", user_code=True) ], )