Airflow signals SIGTERM to subprocesses unexpectedly(气流信号出乎意料地向子过程发出信号)
本文介绍了气流信号出乎意料地向子过程发出信号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用PythonOperator调用一个函数,该函数将数据工程流程并行化为气流任务。这只需用Airflow调用的可调用包装函数包装一个简单函数即可。
def wrapper(ds, **kwargs):
process_data()
使用派生子进程的多处理模块实现并行化。当我从jupyter笔记本单独运行process_data时,它运行到最后都没有问题。然而,当我使用气流运行它时,任务失败,任务的日志显示如下所示。
[2019-01-22 17:16:46,966] {models.py:1610} ERROR - Received SIGTERM. Terminating subprocesses.
[2019-01-22 17:16:46,969] {logging_mixin.py:95} WARNING - Process ForkPoolWorker-129:
[2019-01-22 17:16:46,973] {logging_mixin.py:95} WARNING - Traceback (most recent call last):
[2019-01-22 17:16:46,973] {logging_mixin.py:95} WARNING - File "/usr/lib/python3.5/multiprocessing/process.py", line 249, in _bootstrap
self.run()
[2019-01-22 17:16:46,973] {logging_mixin.py:95} WARNING - File "/home/airflow/.env/lib/python3.5/site-packages/airflow/models.py", line 1612, in signal_handler
raise AirflowException("Task received SIGTERM signal")
[2019-01-22 17:16:46,973] {logging_mixin.py:95} WARNING - airflow.exceptions.AirflowException: Task received SIGTERM signal
[2019-01-22 17:16:46,993] {models.py:1610} ERROR - Received SIGTERM. Terminating subprocesses.
[2019-01-22 17:16:46,996] {logging_mixin.py:95} WARNING - Process ForkPoolWorker-133:
[2019-01-22 17:16:46,999] {logging_mixin.py:95} WARNING - Traceback (most recent call last):
[2019-01-22 17:16:46,999] {logging_mixin.py:95} WARNING - File "/usr/lib/python3.5/multiprocessing/process.py", line 249, in _bootstrap
self.run()
[2019-01-22 17:16:46,999] {logging_mixin.py:95} WARNING - File "/usr/lib/python3.5/multiprocessing/process.py", line 93, in run
self._target(*self._args, **self._kwargs)
[2019-01-22 17:16:46,999] {logging_mixin.py:95} WARNING - File "/usr/lib/python3.5/multiprocessing/pool.py", line 108, in worker
task = get()
[2019-01-22 17:16:46,999] {logging_mixin.py:95} WARNING - File "/usr/lib/python3.5/multiprocessing/queues.py", line 343, in get
res = self._reader.recv_bytes()
[2019-01-22 17:16:46,999] {logging_mixin.py:95} WARNING - File "/usr/lib/python3.5/multiprocessing/synchronize.py", line 99, in __exit__
return self._semlock.__exit__(*args)
[2019-01-22 17:16:46,999] {logging_mixin.py:95} WARNING - File "/home/airflow/.env/lib/python3.5/site-packages/airflow/models.py", line 1612, in signal_handler
raise AirflowException("Task received SIGTERM signal")
[2019-01-22 17:16:46,999] {logging_mixin.py:95} WARNING - airflow.exceptions.AirflowException: Task received SIGTERM signal
[2019-01-22 17:16:47,086] {logging_mixin.py:95} INFO - file parsing and processing 256.07
[2019-01-22 17:17:12,938] {logging_mixin.py:95} INFO - combining and sorting 25.85
我不太确定为什么任务会收到SIGTERM。我的猜测是,某个更高级别的进程正在将这些消息发送给子进程。我应该如何调试此问题?
我刚刚注意到,在接近任务日志末尾时,它清楚地表明
airflow.exceptions.AirflowException: Task received SIGTERM signal
[2019-01-22 12:31:39,196] {models.py:1764} INFO - Marking task as FAILED.
推荐答案
我按照答案here操作。 想法是一样的:不让气流过早关闭线程:
export AIRFLOW__CORE__KILLED_TASK_CLEANUP_TIME=604800
成功了。
这篇关于气流信号出乎意料地向子过程发出信号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
沃梦达教程
本文标题为:气流信号出乎意料地向子过程发出信号
基础教程推荐
猜你喜欢
- 如何在 Python 中检测文件是否为二进制(非文本)文 2022-01-01
- 使用 Google App Engine (Python) 将文件上传到 Google Cloud Storage 2022-01-01
- 合并具有多索引的两个数据帧 2022-01-01
- 将 YAML 文件转换为 python dict 2022-01-01
- 使 Python 脚本在 Windows 上运行而不指定“.py";延期 2022-01-01
- 症状类型错误:无法确定关系的真值 2022-01-01
- 哪些 Python 包提供独立的事件系统? 2022-01-01
- 如何在Python中绘制多元函数? 2022-01-01
- 使用Python匹配Stata加权xtil命令的确定方法? 2022-01-01
- Python 的 List 是如何实现的? 2022-01-01