Skip to content
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

Fix airflow dag trigger cli #20781

Merged
merged 1 commit into from Jan 12, 2022
Merged

Fix airflow dag trigger cli #20781

merged 1 commit into from Jan 12, 2022

Conversation

mingshi-wang
Copy link
Contributor

The "airflow dag trigger" reports a harmless yet annoying warning message "Calling DAG.create_dagrun() without an explicit data interval is deprecated". The issue can be fixed by setting the create_dagrun function argument data_interval to the same value as is calculated by the function.

closes: #20579

^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, 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 UPDATING.md.

@boring-cyborg boring-cyborg bot added the area:API Airflow's REST/HTTP API label Jan 10, 2022
@mingshi-wang mingshi-wang changed the title Fix airflow trigger cli Fix airflow dag trigger cli Jan 10, 2022
@@ -88,6 +88,9 @@ def _trigger_dag(
conf=run_conf,
external_trigger=True,
dag_hash=dag_bag.dags_hash.get(dag_id),
data_interval=_dag.timetable.infer_manual_data_interval(
run_after=timezone.coerce_datetime(execution_date)
Copy link
Member

@uranusjr uranusjr Jan 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

execution_date is never None and already aware at this point, so pendulum.instance() is probably a better call.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated as suggested.

@@ -76,6 +76,7 @@ def test_trigger_dag(self, mock):
conf=None,
external_trigger=True,
dag_hash=ANY,
data_interval=ANY,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be checkable, can you try to not use ANY here (and the one below)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I also updated the test to check the value of "dag_hash".

@github-actions github-actions bot added the okay to merge It's ok to merge this PR as it does not require more tests label Jan 10, 2022
@github-actions
Copy link

The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:API Airflow's REST/HTTP API okay to merge It's ok to merge this PR as it does not require more tests type:bug-fix Changelog: Bug Fixes
Projects
None yet
4 participants