-
Notifications
You must be signed in to change notification settings - Fork 16.4k
AIP-83 amendment: Add logic for generating run_id when logical date is None. #46616
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
AIP-83 amendment: Add logic for generating run_id when logical date is None. #46616
Conversation
6776668 to
25cfbf8
Compare
175ad1f to
fd91711
Compare
a351015 to
9b2116e
Compare
e6ccc9f to
2a4dc29
Compare
uranusjr
left a comment
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.
Two minor issues in test set up, otherwise this should be ready.
2a4dc29 to
5470414
Compare
@uranusjr these should be fixed now. |
|
I think we need to make run_after non public. Feels like we should not expose this to the user as an option -- but rather, it's something that the scheduler should figure out based on the dag / dag run. |
| dag_bag: DagBag, | ||
| *, | ||
| triggered_by: DagRunTriggeredByType, | ||
| run_after: datetime, |
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.
so like e.g. this, not sure it makes sense to have this param
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.
but basically, any public function or public endpoint, my thought is, probably we should not expose this to user as an option / param. essentially it's read only attr i'm thinking.
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.
Created an issue here to fix this: #46650
…s None. (apache#46616) Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
In Airflow 3.x, commit 035060d (PR apache#46616) changed the trigger_dag module to use DagRun.generate_run_id() instead of dag.timetable.generate_run_id() for manual DAG runs. This bypassed custom timetable logic, causing a regression from Airflow 2.x behavior. This commit restores the use of dag.timetable.generate_run_id() for manual triggers, allowing custom timetables to control run_id generation for both scheduled and manually triggered runs. Changes: - airflow/api/common/trigger_dag.py: Changed to call dag.timetable.generate_run_id() with run_after and data_interval parameters instead of DagRun.generate_run_id() - tests/api_fastapi/core_api/routes/public/test_dag_run.py: Added test to verify custom timetable generate_run_id is called for manual triggers with both logical_date provided and null This pattern matches how manual triggers are handled in other parts of the codebase (e.g., assets.py, scheduler_job_runner.py). Fixes: apache#55908
In Airflow 3.x, commit 035060d (PR apache#46616) changed the trigger_dag module to use DagRun.generate_run_id() instead of dag.timetable.generate_run_id() for manual DAG runs. This bypassed custom timetable logic, causing a regression from Airflow 2.x behavior. This commit restores the use of dag.timetable.generate_run_id() for manual triggers, allowing custom timetables to control run_id generation for both scheduled and manually triggered runs. Changes: - airflow/api/common/trigger_dag.py: Changed to call dag.timetable.generate_run_id() with run_after and data_interval parameters instead of DagRun.generate_run_id() - tests/api_fastapi/core_api/routes/public/test_dag_run.py: Added test to verify custom timetable generate_run_id is called for manual triggers with both logical_date provided and null This pattern matches how manual triggers are handled in other parts of the codebase (e.g., assets.py, scheduler_job_runner.py). Fixes: apache#55908
In Airflow 3.x, commit 035060d (PR apache#46616) changed the trigger_dag module to use DagRun.generate_run_id() instead of dag.timetable.generate_run_id() for manual DAG runs. This bypassed custom timetable logic, causing a regression from Airflow 2.x behavior. This commit restores the use of dag.timetable.generate_run_id() for manual triggers, allowing custom timetables to control run_id generation for both scheduled and manually triggered runs. Changes: - airflow/api/common/trigger_dag.py: Changed to call dag.timetable.generate_run_id() with run_after and data_interval parameters instead of DagRun.generate_run_id() - tests/api_fastapi/core_api/routes/public/test_dag_run.py: Added test to verify custom timetable generate_run_id is called for manual triggers with both logical_date provided and null This pattern matches how manual triggers are handled in other parts of the codebase (e.g., assets.py, scheduler_job_runner.py). Fixes: apache#55908
This PR started with changes on #46398. As the logic on 46398 has changed, I have created a different PR and closed the other PR
For the AIP 83 amendment, when a null logical date is provided, run_id is run_after + random string.
Closes: #46199
^ 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.rstor{issue_number}.significant.rst, in newsfragments.