ashb commented on a change in pull request #15125:
URL: https://github.com/apache/airflow/pull/15125#discussion_r605492436
##########
File path: airflow/utils/decorators.py
##########
@@ -97,6 +99,44 @@ def wrapper(*args: Any, **kwargs: Any) -> Any:
return cast(T, wrapper)
+def latest_only(f):
+ """
+ Decorator for adding skip-if-not-latest behavior to any operator.
+
+ Can be disabled if the class has an attribute ``latest_only`` with value
``False``
+ """
+
+ def skip_if_not_latest(context):
+ if not context: # assume run interactively
+ return
+ dag_run = context.get('dag_run')
+ if dag_run and dag_run.external_trigger:
+ print("Externally triggered DAG_Run: allowing execution to
proceed.")
Review comment:
Should probably be log, not print.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]