-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Add run_on_latest_version support for backfill and clear operations #52177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add run_on_latest_version support for backfill and clear operations #52177
Conversation
1f4b2e3
to
bfc2a49
Compare
With this option, users are able to choose the dag version they want to run their dag/task after clearing or when running backfill. This only applies to versioned bundles as non-versioned bundles run with the latest dag version. When the user choose the run with latest version, the bundle_version associated with the dagrun is updated to the latest and the associated serialized dag version updated to the latest. Choosing not to run with latest version which is the default means that the bundle version and serialized dag version that the dag ran with initially would be used in running it again. For backfill, there's now --run-on-latest-version flag that makes it run with the latest version, otherwise it will run with the original bundle the dagrun was created with. Note that it's only useful when rerunning a dagrun using backfill. The default behaviour is using the initial bundle/version and this is intentional otherwise running backfill will fail if there was task rename in the latest version. Summary of changes: - Use SchedulerDagBag instead of DagBag for execution API - Add run_on_latest_version field to DAGRunClearBody and ClearTaskInstancesBody models - Add --run-on-latest-version CLI flag for backfill command - Update backfill.py to support running tasks with latest DAG version - Add UI checkbox for "Run with latest version" in clear dialogs - Update SchedulerDagBag to handle latest version parameter - Update API endpoints to support run_on_latest_version parameter
bfc2a49
to
661e02a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. There are some questions about the usage of SchedulerDagBag
in core-api.
@@ -83,8 +83,10 @@ def create_app(apps: str = "all") -> FastAPI: | |||
dag_bag = create_dag_bag() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dag_bag = create_dag_bag() |
airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py
Show resolved
Hide resolved
UI for dagrun clear and task instance clear look good. We'll add this to backfills next? |
With this option, users are able to choose the dag version they want
to run their dag/task after clearing or when running backfill. This
only applies to versioned bundles as non-versioned bundles run with
the latest dag version.
When the user choose the run with latest version, the bundle_version
associated with the dagrun is updated to the latest and the associated
serialized dag version updated to the latest. Choosing not to run
with latest version which is the default means that the bundle version
and serialized dag version that the dag ran with initially would be used
in running it again.
For backfill, there's now --run-on-latest-version flag that makes it run
with the latest version, otherwise it will run with the original bundle
the dagrun was created with. Note that it's only useful when rerunning
a dagrun using backfill. The default behaviour is using the initial bundle/version
and this is intentional otherwise running backfill will fail if there was
task rename in the latest version.
Summary of changes:
closes: #49007, closes: #49047