Skip to content

Fix TimeSensor dag_version churn by removing start_from_trigger support#69746

Open
Vamsi-klu wants to merge 1 commit into
apache:mainfrom
Vamsi-klu:fix/time-sensor-dag-version-69543
Open

Fix TimeSensor dag_version churn by removing start_from_trigger support#69746
Vamsi-klu wants to merge 1 commit into
apache:mainfrom
Vamsi-klu:fix/time-sensor-dag-version-69543

Conversation

@Vamsi-klu

Copy link
Copy Markdown
Contributor

Problem

TimeSensor with start_from_trigger=True creates new SerializedDag version every parse because init computes target_datetime via datetime.now(dag.timezone) and bakes into start_trigger_args.trigger_kwargs.moment, part of serialized hash. Causes DB bloat.

What I did

  • Remove start_trigger_args and start_from_trigger
  • Store only raw target_time at init
  • Compute target datetime at execution time via _get_target_datetime()
  • Backward compat warning for start_from_trigger kwarg
  • Keep target_datetime as property for compat
  • Fix docs

Impact

Fixes dag_version churn, preserves behavior, aligns with TimeDeltaSensor.

Testing

Existing tests 10 passed, temporal triggers 19 passed. Manual serialization stability verified.

Fixes: #69543

Was generative AI tooling used to co-author this PR?
  • Yes — Muse Spark 1.1
    Generated-by: Muse Spark 1.1

TimeSensor computed target_datetime using datetime.now() at DAG-parse
time and baked it into start_trigger_args.trigger_kwargs.moment. Since
that field is serialized into serialized_dag, the dag hash changed on
every parse, creating a new DagVersion each scheduler loop.

This removes the start_from_trigger feature from TimeSensor (consistent
with TimeDeltaSensor which never had it because its target depends on
runtime context) and moves target_datetime computation from __init__
to execution time (poke/execute). Wall-clock behavior is preserved,
but no volatile value enters serialization.

Fixes: apache#69543
@Vamsi-klu

Copy link
Copy Markdown
Contributor Author

Reviewers: @ashb (core serialization / sensors) + @potiuk @kaxil for standard provider. This fixes dag_version churn by moving target_datetime computation to execution time.

Fixes #69543


Drafted-by: Muse Spark 1.1; reviewed by @Vamsi-klu before posting

@Vamsi-klu Vamsi-klu marked this pull request as ready for review July 11, 2026 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dag_version inflection when using TimeSensor with start_from_trigger = True

1 participant