ashb commented on a change in pull request #6633: [AIRFLOW-2279] Clear tasks 
across DAGs if marked by ExternalTaskMarker
URL: https://github.com/apache/airflow/pull/6633#discussion_r358181634
 
 

 ##########
 File path: airflow/models/dag.py
 ##########
 @@ -950,6 +990,60 @@ def clear(
         if only_running:
             tis = tis.filter(TI.state == State.RUNNING)
 
+        if include_subdags:
+            # Recursively find external tasks indicated by ExternalTaskMarker
+            instances = tis.all()
+            for ti in instances:
+                if ti.operator == ExternalTaskMarker.__name__:
 
 Review comment:
   `isinstance(ti.task, ExternalTaskMarker)` -- make sure that the import for 
this is "delayed" until it's needed, i.e. somewhere in "this" block. (not the 
loop, but the "if clearing these dags")
   
   @kaxil Which of these is better from a Dag Serialization PoV? Doesn't matter 
right? 

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to