You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/04/12 15:50:04 UTC

[GitHub] [airflow] mik-laj commented on a change in pull request #8259: [AIRFLOW-XXX] Optimize airflow scheduler

mik-laj commented on a change in pull request #8259: [AIRFLOW-XXX] Optimize airflow scheduler
URL: https://github.com/apache/airflow/pull/8259#discussion_r407216494
 
 

 ##########
 File path: airflow/jobs.py
 ##########
 @@ -1644,26 +1738,31 @@ def _execute_helper(self, processor_manager):
                 # If a task instance is up for retry but the corresponding DAG run
                 # isn't running, mark the task instance as FAILED so we don't try
                 # to re-run it.
-                self._change_state_for_tis_without_dagrun(simple_dag_bag,
-                                                          [State.UP_FOR_RETRY],
-                                                          State.FAILED)
+                ret = self._change_state_for_tis_without_dagrun(simple_dag_bag,
+                                                                [State.UP_FOR_RETRY],
+                                                                State.FAILED)
+                if not ret:
+                    continue
                 # If a task instance is scheduled or queued, but the corresponding
                 # DAG run isn't running, set the state to NONE so we don't try to
                 # re-run it.
-                self._change_state_for_tis_without_dagrun(simple_dag_bag,
-                                                          [State.QUEUED,
-                                                           State.SCHEDULED],
-                                                          State.NONE)
-
+                ret = self._change_state_for_tis_without_dagrun(simple_dag_bag,
+                                                                [State.QUEUED,
+                                                                 State.SCHEDULED],
+                                                                State.NONE)
+                if not ret:
+                    continue
                 self._execute_task_instances(simple_dag_bag,
                                              (State.SCHEDULED,))
 
             # Call heartbeats
             self.log.info("Heartbeating the executor")
             self.executor.heartbeat()
 
-            # Process events from the executor
-            self._process_executor_events(simple_dag_bag)
+            # Process all events from the executor
+            full_simple_dag_bag = SimpleDagBag(self.full_simple_dags.values())
+            self.executor_events = self._process_executor_events(full_simple_dag_bag)
 
 Review comment:
   This has already been introduced in Airflow 2.0. https://github.com/apache/airflow/pull/7597

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services