feng-tao commented on a change in pull request #4396: [AIRFLOW-3585] - Add 
edges to database
URL: https://github.com/apache/airflow/pull/4396#discussion_r259594132
 
 

 ##########
 File path: airflow/models/__init__.py
 ##########
 @@ -688,6 +632,57 @@ def __init__(self, task, execution_date, state=None):
         # Not persisted to the database so only valid for the current process
         self.raw = False
 
+    @staticmethod
+    @provide_session
+    def clear_task_instances(tis,
+                             activate_dag_runs=True,
+                             dag=None,
+                             session=None
+                             ):
+        """
+        Clears a set of task instances, but makes sure the running ones
+        get killed.
+
+        :param tis: a list of task instances
+        :param activate_dag_runs: flag to check for active dag run
+        :param dag: DAG object
+        :param session: current session
+        """
+        job_ids = set()
+        for ti in tis:
+            if ti.state == State.RUNNING:
+                if ti.job_id:
 
 Review comment:
   what happens to the case when ti.job_id is none?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to