Skip to content

Commit 87fcc1c

Browse files
authored
[TWTR][CX-17516] Requeue tasks in the queued state (twitter-forks#27)
1 parent 54bd095 commit 87fcc1c

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

airflow/executors/base_executor.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ def queue_command(self, task_instance, command, priority=1, queue=None):
5454
key = task_instance.key
5555
if key not in self.queued_tasks and key not in self.running:
5656
self.log.info("Adding to queue: %s", command)
57-
self.queued_tasks[key] = (command, priority, queue, task_instance)
5857
else:
59-
self.log.info("could not queue task {}".format(key))
58+
self.log.info("Adding to queue even though already queued or running {}".format(command, key))
59+
self.queued_tasks[key] = (command, priority, queue, task_instance)
6060

6161
def queue_task_instance(
6262
self,

airflow/jobs.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -1728,8 +1728,13 @@ def _execute_helper(self, processor_manager):
17281728
scheduled_dag_ids = ", ".join(simple_dag_bag.dag_ids)
17291729
self.log.info('DAGs to be executed: {}'.format(scheduled_dag_ids))
17301730

1731+
# TODO(CX-17516): State.QUEUED has been added here which is a hack as the Celery
1732+
# Executor does not reliably enqueue tasks with the my MySQL broker, and we have
1733+
# seen tasks hang after they get queued. The effect of this hack is queued tasks
1734+
# will constantly be requeued and resent to the executor (Celery).
1735+
# This should be removed when we switch away from the MySQL Celery backend.
17311736
self._execute_task_instances(simple_dag_bag,
1732-
(State.SCHEDULED,))
1737+
(State.SCHEDULED, State.QUEUED))
17331738

17341739
# Call heartbeats
17351740
self.log.debug("Heartbeating the executor")

airflow/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
# under the License.
1919
#
2020

21-
version = '1.10.0+twtr24'
21+
version = '1.10.0+twtr25'

0 commit comments

Comments
 (0)