o-nikolas commented on code in PR #54038:
URL: https://github.com/apache/airflow/pull/54038#discussion_r2248884132


##########
providers/amazon/src/airflow/providers/amazon/aws/executors/ecs/ecs_executor.py:
##########
@@ -403,11 +407,13 @@ def attempt_task_runs(self):
                 # wrong.  For any possible failure we want to add the 
exception reasons to the
                 # failure list so that it is logged to the user and most 
importantly the task is
                 # added back to the pending list to be retried later.
+                self.log.info("ECS task %s has ran into an exception. Reason: 
%s", task_key, str(e))

Review Comment:
   Error is appended to the failure reasons which are logged separately. If 
that's not working we should fix that instead of logging each one to reduce 
spam.



##########
providers/amazon/src/airflow/providers/amazon/aws/executors/ecs/ecs_executor.py:
##########
@@ -382,18 +382,22 @@ def attempt_task_runs(self):
             cmd = ecs_task.command
             queue = ecs_task.queue
             exec_config = ecs_task.executor_config
+            self.log.info("ECS task executor config: %s", exec_config)

Review Comment:
   Here and below, we have to be very careful about adding logging. When you're 
debugging one test run it can feel reasonable, but you have to remember when 
this is up and running at scale in a production environment you can have 
hundreds or even thousands of tasks executing in minutes. These kinds of 
superfluous logs can really clog up the scheduler log file. If you think this 
is still worth logging, please make it debug and also add the task id that it 
belongs to.



##########
providers/amazon/src/airflow/providers/amazon/aws/executors/ecs/ecs_executor.py:
##########
@@ -382,18 +382,22 @@ def attempt_task_runs(self):
             cmd = ecs_task.command
             queue = ecs_task.queue
             exec_config = ecs_task.executor_config
+            self.log.info("ECS task executor config: %s", exec_config)
             attempt_number = ecs_task.attempt_number
             failure_reasons = []
             if timezone.utcnow() < ecs_task.next_attempt_time:
                 self.pending_tasks.append(ecs_task)
                 continue
             try:
                 run_task_response = self._run_task(task_key, cmd, queue, 
exec_config)
+                self.log.info("ECS task %s has succeeded.", task_key)

Review Comment:
   This doesn't mean it was successful per se, just that the control plane 
accepted the job. It could fail later on in ECS or during Airflow task 
execution within the container.
   
   If you re-scope the message and still think it's worth keeping, please 
change to debug.



##########
providers/amazon/src/airflow/providers/amazon/aws/executors/ecs/ecs_executor.py:
##########
@@ -403,11 +407,13 @@ def attempt_task_runs(self):
                 # wrong.  For any possible failure we want to add the 
exception reasons to the
                 # failure list so that it is logged to the user and most 
importantly the task is
                 # added back to the pending list to be retried later.
+                self.log.info("ECS task %s has ran into an exception. Reason: 
%s", task_key, str(e))
                 failure_reasons.append(str(e))
             else:
                 # We got a response back, check if there were failures. If so, 
add them to the
                 # failures list so that it is logged to the user and most 
importantly the task
                 # is added back to the pending list to be retried later.
+                self.log.info("ECS task %s has failed, but response was 
seen.", task_key)

Review Comment:
   The failures intentionally aren't logged here so reduce spam, all failures 
are logged further down the line, we should fix that if that's not working 
properly.



##########
providers/amazon/src/airflow/providers/amazon/aws/executors/ecs/ecs_executor.py:
##########
@@ -382,18 +382,22 @@ def attempt_task_runs(self):
             cmd = ecs_task.command
             queue = ecs_task.queue
             exec_config = ecs_task.executor_config
+            self.log.info("ECS task executor config: %s", exec_config)
             attempt_number = ecs_task.attempt_number
             failure_reasons = []
             if timezone.utcnow() < ecs_task.next_attempt_time:
                 self.pending_tasks.append(ecs_task)
                 continue
             try:
                 run_task_response = self._run_task(task_key, cmd, queue, 
exec_config)
+                self.log.info("ECS task %s has succeeded.", task_key)
             except NoCredentialsError:
                 self.pending_tasks.append(ecs_task)
+                self.log.info("ECS task %s has no credentials error.", 
task_key)
                 raise

Review Comment:
   This is caught and logged elsewhere:
   
   
https://github.com/aws-mwaa/upstream-to-airflow/blob/bcd294d63485c57a601321818dcddff94c572d73/providers/amazon/src/airflow/providers/amazon/aws/executors/ecs/ecs_executor.py#L247-L253



##########
providers/amazon/src/airflow/providers/amazon/aws/executors/ecs/ecs_executor.py:
##########
@@ -382,18 +382,22 @@ def attempt_task_runs(self):
             cmd = ecs_task.command
             queue = ecs_task.queue
             exec_config = ecs_task.executor_config
+            self.log.info("ECS task executor config: %s", exec_config)
             attempt_number = ecs_task.attempt_number
             failure_reasons = []
             if timezone.utcnow() < ecs_task.next_attempt_time:
                 self.pending_tasks.append(ecs_task)
                 continue
             try:
                 run_task_response = self._run_task(task_key, cmd, queue, 
exec_config)
+                self.log.info("ECS task %s has succeeded.", task_key)
             except NoCredentialsError:
                 self.pending_tasks.append(ecs_task)
+                self.log.info("ECS task %s has no credentials error.", 
task_key)
                 raise
             except ClientError as e:
                 error_code = e.response["Error"]["Code"]
+                self.log.info("ECS task %s has client error", task_key)

Review Comment:
   Error is appended to the failure reasons which are logged separately. If 
that's not working we should fix that instead of logging each one to reduce 
spam.



-- 
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