-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
Remove logical_date from DAG Run APIs and Functions, transition to run_id as sole identifier for Airflow 3.0 #42404
Conversation
airflow/providers/cncf/kubernetes/executors/kubernetes_executor.py
Outdated
Show resolved
Hide resolved
3e729bc
to
efa47f6
Compare
9212ef8
to
24a1673
Compare
14dac57
to
9f3adfc
Compare
…API is used to look up a DAG run Remove execution_date and logical_date from arguments where function/API is used to look up a DAG run - Resolve compatibility issues and refactor `execution_date` to `logical_date` - Resolve compatibility tests - Correct import paths after rebase - Address static checks - Refactor `execution_date` to `logical_date` - Add missing DAG files for tests - Enhance GCP ML and CloudBuild tests using helpers for compatibility - Fix mypy errors - Miscellaneous fixes and removals of `execution_date` - Resolve compatibility tests - Correct import paths after rebase - Address static checks - Refactor `execution_date` to `logical_date` - Add missing DAG files for tests - Enhance GCP ML and CloudBuild tests using helpers for compatibility - Fix mypy errors - Miscellaneous fixes and removals of `execution_date` - Resolve compatibility tests - Correct import paths after rebase - Address static checks - Refactor `execution_date` to `logical_date` - Add missing DAG files for tests - Enhance GCP ML and CloudBuild tests using helpers for compatibility - Fix mypy errors - Miscellaneous fixes and removals of `execution_date` - Drop execution_date unique constraint on DagRun - The column has also been renamed to logical_date, although the Python model is not changed. This allows us to not need to fix all the Python code at once (we'll do that later), but still do the two changes in one migration instead of two. - Use test helpers in GCP MLEngine tests for compat - Using Airflow internals directly presents a problem when dealing with compatibility in tests (since the same tests must run against Airflow 2 and 3). The helpers already handle this well, so we should use them. - Use test helpers in GCP CloudBuild tests for compat - Using Airflow internals directly presents a problem when dealing with compatibility in tests (since the same tests must run against Airflow 2 and 3). The helpers already handle this well, so we should use them. - Mark db tests - Some compat code to make DAG.clear() still work - Remove unneeded test cases for compat code - Use test helpers in GCS-BQ tests for compat - Using Airflow internals directly presents a problem when dealing with compatibility in tests (since the same tests must run against Airflow 2 and 3). The helpers already handle this well, so we should use them.
Fix tests and schema
9f3adfc
to
76b21d2
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.
Assuming green
…he#42404) Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
@sunank200 , will there be another PR to remove logical_date from Fastapi endpoints as well? |
@rawwar I think |
We should remove it if the frontend can work without them. |
…he#42404) Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
…he#42404) Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
After renaming
execuiton_date
tological_date
in 43902 this PR removes thelogical_date
arguments from functions and APIs that are used to retrieve DAG runs, aligning with the broader changes introduced in Airflow 2.2 and preparing for Airflow 3.0. The functions now userun_id
as the sole identifier for DAG runs, simplifying the process and eliminating deprecated behaviour.Motivation:
In Airflow,
execution_date
has historically been used to distinguish different DAG run instances. However, the introduction ofrun_id
and the DAG run concept in Airflow 2.2 shifts away from usingexecution_date
as an identifier. Continuing to rely onexecution_date
introduces limitations, such as the inability to handle multiple DAG runs at the same logical time, especially in cases likeTriggerDagRunOperator
when dynamic runs are generated.This PR eliminates these limitations by removing
execution_date
andlogical_date
in favor ofrun_id
.Key Changes:
API and Function Changes:
logical_date
arguments have been removed from all public APIs and Python functions related to DAG run lookups.run_id
is now the exclusive identifier for DAG runs in these contexts.Database Migration:
execution_date
in the database has been dropped, asrun_id
now ensures the uniqueness of DAG runs as part of #41818Rationale:
Removing
execution_date
is necessary to enable more flexible DAG run management. For example, dynamic runs created byTriggerDagRunOperator
can now be correctly identified and managed without awkward workarounds as discussed in this doc. This change makes subsequent DAG run lookups easier and more robust, while also simplifying the database schema by removing the unique constraint onexecution_date
.How
execution_date
andlogical_date
WorkAdditionally, users will still be able to view
execution_date
for reference, renamed aslogical_date
, and paired withrun_id
for clarity in the web UI, making it easier to distinguish between DAG runs.Testing
closes: #42339, #42340 and #42338
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rst
or{issue_number}.significant.rst
, in newsfragments.