pingzh commented on a change in pull request #21602:
URL: https://github.com/apache/airflow/pull/21602#discussion_r812247182



##########
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:
       @uranusjr  good call. updated. thanks 




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to