yuqian90 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_r358151893
 
 

 ##########
 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:
   I looked into taskinstance.py. TaskInstance.operator is a String stored in 
the database. It's assigned the name of the class during its construction.
   ```
   operator = Column(String(1000))
   ```
   
   However, you have a point that this line is a little awkward. Is there a 
better way to say "if this taskinstance is created from a instance of 
`ExternalTaskMarker`" ?

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