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 2022/02/22 09:36:25 UTC
[GitHub] [airflow] uranusjr commented on a change in pull request #21602: add celery.task_timeout_error metric
uranusjr commented on a change in pull request #21602:
URL: https://github.com/apache/airflow/pull/21602#discussion_r811746947
##########
File path: airflow/executors/celery_executor.py
##########
@@ -82,14 +82,17 @@
def execute_command(command_to_exec: CommandType) -> None:
"""Executes command."""
BaseExecutor.validate_command(command_to_exec)
- log.info("Executing command in Celery: %s", command_to_exec)
celery_task_id = app.current_task.request.id
- log.info(f"Celery task ID: {celery_task_id}")
+ log.info("[%s] Executing command in Celery: %s", celery_task_id, command_to_exec)
- if settings.EXECUTE_TASKS_NEW_PYTHON_INTERPRETER:
- _execute_in_subprocess(command_to_exec, celery_task_id)
- else:
- _execute_in_fork(command_to_exec, celery_task_id)
+ try:
+ if settings.EXECUTE_TASKS_NEW_PYTHON_INTERPRETER:
+ _execute_in_subprocess(command_to_exec, celery_task_id)
+ else:
+ _execute_in_fork(command_to_exec, celery_task_id)
+ except Exception as e:
+ Stats.incr("celery.execute_command.failure")
+ raise e
Review comment:
```suggestion
except Exception:
Stats.incr("celery.execute_command.failure")
raise
```
This keeps the original traceback.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org