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 2021/07/07 08:15:01 UTC

[GitHub] [airflow] pmalafosse commented on a change in pull request #16685: reattach_prev_task ECSOperator

pmalafosse commented on a change in pull request #16685:
URL: https://github.com/apache/airflow/pull/16685#discussion_r665147061



##########
File path: airflow/providers/amazon/aws/operators/ecs.py
##########
@@ -274,15 +301,14 @@ def _try_reattach_task(self):
         )
         running_tasks = list_tasks_resp['taskArns']
 
-        running_tasks_count = len(running_tasks)
-        if running_tasks_count > 1:
-            self.arn = running_tasks[0]
-            self.log.warning('More than 1 ECS Task found. Reattaching to %s', self.arn)
-        elif running_tasks_count == 1:
-            self.arn = running_tasks[0]
-            self.log.info('Reattaching task: %s', self.arn)
+        # Check if the ECS task previously launched is already running
+        previous_task_arn = self.xcom_pull(task_ids=f"{self.task_id}_task_arn", key="ecs_task_arn")
+        self.log.info(f"Previously launched task = {previous_task_arn}")

Review comment:
       I will remove it, 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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org