Cloud Composer 2中GoogleSheetsToGCSOperator报Negsignal.SIGKILL问题
Google Cloud Composer 2 中 Airflow GoogleSheetsToGCSOperator 运行异常问题
我们在Google Cloud Composer 2环境运行Airflow,使用GoogleSheetsToGCSOperator时遇到问题。已经通过配置正确权限范围的连接解决了权限错误,但DAG仍无法正常运行,存在两种失败情况:
情况1:Google Sheets上传GCS任务频繁报Negsignal.SIGKILL
多数情况下,执行Google Sheets上传至GCS的任务会报错Negsignal.SIGKILL,相关日志如下:
-------------------------------------------------------------------------------- [2022-10-03, 15:50:55 UTC] {taskinstance.py:1251} INFO - Starting attempt 1 of 1 [2022-10-03, 15:50:55 UTC] {taskinstance.py:1252} INFO - -------------------------------------------------------------------------------- [2022-10-03, 15:50:55 UTC] {taskinstance.py:1271} INFO - Executing <Task(GoogleSheetsToGCSOperator): upload_sheet_to_gcs_airflow_permission_test_sheet> on 2022-10-03 15:50:38.412899+00:00 [2022-10-03, 15:50:55 UTC] {standard_task_runner.py:52} INFO - Started process 529848 to run task [2022-10-03, 15:50:55 UTC] {standard_task_runner.py:79} INFO - Running: ['airflow', 'tasks', 'run', 'test_brunel_core_2', 'upload_sheet_to_gcs_airflow_permission_test_sheet', 'manual__2022-10-03T15:50:38.412899+00:00', '--job-id', '7342', '--raw', '--subdir', 'DAGS_FOLDER/DAGs/z_airflow_testing_dags/test_brunel_2_functions.py', '--cfg-path', '/tmp/tmpyuhkixqc', '--error-file', '/tmp/tmp7p2delaz'] [2022-10-03, 15:50:55 UTC] {standard_task_runner.py:80} INFO - Job 7342: Subtask upload_sheet_to_gcs_airflow_permission_test_sheet /opt/python3.8/lib/python3.8/site-packages/airflow/utils/log/file_task_handler.py:110: ResourceWarning: unclosed file <_io.TextIOWrapper name='/home/airflow/gcs/logs/test_brunel_core_2/upload_sheet_to_gcs_airflow_permission_test_sheet/2022-10-03T15:50:38.412899+00:00/1.log' mode='a' encoding='utf-8'> self.handler = NonCachingFileHandler(local_loc, encoding='utf-8') [2022-10-03, 15:50:56 UTC] {task_command.py:298} INFO - Running <TaskInstance: test_brunel_core_2.upload_sheet_to_gcs_airflow_permission_test_sheet manual__2022-10-03T15:50:38.412899+00:00 [running]> on host airflow-worker-j28mn [2022-10-03, 15:50:56 UTC] {taskinstance.py:1448} INFO - Exporting the following env vars: AIRFLOW_CTX_DAG_OWNER=process_dev_joe_m AIRFLOW_CTX_DAG_ID=test_brunel_core_2 AIRFLOW_CTX_TASK_ID=upload_sheet_to_gcs_airflow_permission_test_sheet AIRFLOW_CTX_EXECUTION_DATE=2022-10-03T15:50:38.412899+00:00 AIRFLOW_CTX_DAG_RUN_ID=manual__2022-10-03T15:50:38.412899+00:00 [2022-10-03, 15:51:02 UTC] {local_task_job.py:154} INFO - Task exited with return code Negsignal.SIGKILL [2022-10-03, 15:51:02 UTC] {taskinstance.py:1279} INFO - Marking task as FAILED. dag_id=test_brunel_core_2, task_id=upload_sheet_to_gcs_airflow_permission_test_sheet, execution_date=20221003T155038, start_date=20221003T155055, end_date=20221003T155102
情况2:DAG内随机任务失败,日志异常
其余情况中,DAG内随机任务失败(不一定是GoogleSheetsToGCSOperator步骤),有时无日志生成,有时日志仅包含如下警告:
/opt/python3.8/lib/python3.8/site-packages/airflow/utils/log/file_task_handler.py:110: ResourceWarning: unclosed file <_io.TextIOWrapper name='/home/airflow/gcs/logs/test_flakiness/create_table_JM_test_table.create/2022-10-04T09:11:58.425115+00:00/1.log' mode='a' encoding='utf-8'> self.handler = NonCachingFileHandler(local_loc, encoding='utf-8')
该警告针对正在写入的日志文件,逻辑上不合理。
相关环境信息
- 版本:
composer-2.0.25 airflow-2.2.5 - 监控显示资源(CPU、内存等)未达上限
- 环境配置1-4个Worker,但仅使用1个
- 测试环境出现该问题,生产环境(
composer-1.19.3-airflow-2.2.5)中同一DAG运行正常
内容的提问来源于stack exchange,提问作者Joe
相关产品推荐
相关产品推荐

