-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
Replace external_trigger
check with DagRunType
#45961
base: main
Are you sure you want to change the base?
Replace external_trigger
check with DagRunType
#45961
Conversation
45cf835
to
9eef4f1
Compare
external_trigger
check with DagRunTypeexternal_trigger
check with DagRunType
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 also needs a newsfragment noting about the removal of it please
airflow/migrations/versions/0056_3_0_0_remove_external_trigger_field.py
Outdated
Show resolved
Hide resolved
airflow/migrations/versions/0056_3_0_0_remove_external_trigger_field.py
Outdated
Show resolved
Hide resolved
airflow/migrations/versions/0056_3_0_0_remove_external_trigger_field.py
Outdated
Show resolved
Hide resolved
airflow/models/dagrun.py
Outdated
@@ -1227,11 +1217,11 @@ def _emit_true_scheduling_delay_stats_for_finished_state(self, finished_tis: lis | |||
rid of the outliers on the stats side through dashboards tooling. | |||
|
|||
Note that the stat will only be emitted for scheduler-triggered DAG runs | |||
(i.e. when ``external_trigger`` is *False* and ``clear_number`` is equal to 0). | |||
(i.e. when ``run_type`` is *MANUAL* and ``clear_number`` is equal to 0). |
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.e. when ``run_type`` is *MANUAL* and ``clear_number`` is equal to 0). | |
(i.e. when ``run_type`` is not *MANUAL* and ``clear_number`` is equal to 0). |
Though this brings up another question: How should this function deal with run_type==BACKFILL?
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.
How about adding an externally_triggered_type in airflow.utils.types? Instead of checking run_type == DagRunType.MANUAL
, we could use run_type in externally_triggered_type
. WDYT?
externally_triggered_type: frozenset[DagRunType] = frozenset([DagRunType.BACKFILL_JOB, DagRunType.MANUAL, DagRunType.ASSET_TRIGGERED])
providers/src/airflow/providers/standard/operators/latest_only.py
Outdated
Show resolved
Hide resolved
@@ -53,7 +54,7 @@ def choose_branch(self, context: Context) -> str | Iterable[str]: | |||
# If the DAG Run is externally triggered, then return without | |||
# skipping downstream tasks | |||
dag_run: DagRun = context["dag_run"] # type: ignore[assignment] | |||
if dag_run.external_trigger: | |||
if dag_run.run_type == DagRunType.MANUAL: |
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.
Ditto here about BACKFILL. Need to decide how to handle this
a65904d
to
2fee34c
Compare
closes: #45932
^ 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.