我最近将Airflow从v1.9升级到v1.10.3。我遇到了Airflow无法运行单个任务实例的问题。
1)在DAG中为单个实例点击“运行”任务后,它无法运行。
2)在日志中,我看到Adding to queue: [u'airflow', u'run', '<DAG name>', '<task name>', '2019-08-15T00:01:00+00:00', u'--local', u'-sd', u'DAGS_FOLDER/<filename>.py']
,但无法将其排队
在当前设置中,我们使用Celery Executor进行气流处理:Redis作为代理URL和结果后端
日志:
[2019-08-18 19:29:59,015] {celery_executor.py:155} DEBUG - Starting Celery Executor using 15 processes for syncing
[2019-08-18 19:29:59,016] {base_executor.py:59} INFO - Adding to queue: [u'airflow', u'run', '<DAG name>', '<Task name>', '2019-08-15T00:01:00+00:00', u'--local', u'-sd', u'DAGS_FOLDER/<file_name.py>']
[2019-08-18 19:29:59,016] {celery_executor.py:185} DEBUG - 0 running task instances
[2019-08-18 19:29:59,016] {celery_executor.py:186} DEBUG - 1 in queue
[2019-08-18 19:29:59,016] {celery_executor.py:187} DEBUG - 32 open slots
[2019-08-18 19:30:58 +0000] [121] [CRITICAL] WORKER TIMEOUT (pid:359)
[2019-08-18 19:30:59 +0000] [405] [INFO] Parent changed, shutting down: <Worker 359>
[2019-08-18 19:30:59 +0000] [405] [INFO] Worker exiting (pid: 359)
预期:它应该已经将任务排入队列并运行。
编辑:另外,在调试时,我认为它可能与在 send_task_to_executor()内部调用的Celery方法 task.apply_async 有关。 [在celery_executor.py中。它挂在那里,因此超时。
气流:celery_executor.py
def send_task_to_executor(task_tuple):
key, _, command, queue, task = task_tuple
try:
with timeout(seconds=2):
result = task.apply_async(args=[command], queue=queue)
except Exception as e:
exception_traceback = "Celery Task ID: {}\n{}".format(key,
traceback.format_exc())
result = ExceptionWithTraceback(e, exception_traceback)
return key, command, result