hussein-awala commented on code in PR #39590:
URL: https://github.com/apache/airflow/pull/39590#discussion_r1599119239


##########
airflow/providers/amazon/aws/executors/batch/batch_executor.py:
##########
@@ -306,14 +307,22 @@ def attempt_submit_jobs(self):
                     self.pending_jobs.append(batch_job)
             else:
                 # Success case
+                job_id = submit_job_response["job_id"]
                 self.active_workers.add_job(
-                    job_id=submit_job_response["job_id"],
+                    job_id=job_id,
                     airflow_task_key=key,
                     airflow_cmd=cmd,
                     queue=queue,
                     exec_config=exec_config,
                     attempt_number=attempt_number,
                 )
+                try:
+                    self.running_state(key, job_id)
+                except AttributeError:
+                    # TODO: Remove this when min_airflow_version is 2.10.0 or 
higher in Amazon provider.
+                    # running_state is added in Airflow 2.10 and only needed 
to support task adoption
+                    # (an optional executor feature).
+                    pass

Review Comment:
   nit, `suppress` is preferred here: 
   ```suggestion
                   with contextlib.suppress(AttributeError):
                       # TODO: Remove this when min_airflow_version is 2.10.0 
or higher in Amazon provider.
                       # running_state is added in Airflow 2.10 and only needed 
to support task adoption
                       # (an optional executor feature).
                       self.running_state(key, job_id)
   ```



-- 
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-unsubscr...@airflow.apache.org

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

Reply via email to