-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Fix warning in airflow tasks test command regarding absence of data_interval #27106
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
Conversation
6946ba6 to
a42d747
Compare
airflow/cli/commands/task_command.py
Outdated
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.
This would not always work since infer_automated_data_interval is only designed to provide backward compatibility for DAG runs that are created before the data interval concept was introduced, and a DAG using a custom timetable would not work correctly with this method. I think infer_manual_data_interval is probably a better choice; it is not technically correct (the call below created a scheduled run), but the exact value of the data interval does not actually matter much here anyway since the run is only supposed to be a stub.
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.
yes, since run_type is not passed here this just calls the same part as underlying code to have same behavior. It's infer_manual_data_interval in tests since they pass run_type as manual. The dagrun is also deleted in the end so I guess it's ok.
Lines 2582 to 2585 in ea55626
| if run_type == DagRunType.MANUAL: | |
| data_interval = self.timetable.infer_manual_data_interval(run_after=logical_date) | |
| else: | |
| data_interval = self.infer_automated_data_interval(logical_date) |
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.
I took the liberty to change this myself.
|
Conflicts needs resolving |
a42d747 to
a8c9b31
Compare
|
@potiuk Rebased with latest main branch and resolved conflicts. |
a8c9b31 to
89f6ef1
Compare
|
Well. Not really all fixed. |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
89f6ef1 to
001f18d
Compare
001f18d to
4e29197
Compare
…nterval (#27106) * Fix warning in airflow tasks test command regarding absence of data_interval. * Use manual data interval in task commands * Update tests/cli/commands/test_task_command.py --------- Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com> Co-authored-by: Jarek Potiuk <jarek@potiuk.com> (cherry picked from commit 70680de)
Fixes below warning in
airflow tasks testcommand along with fixing test cases. Similar to PR #20781 and #20579cc: @uranusjr