amoghrajesh commented on code in PR #77158:
URL: https://github.com/apache/airflow/pull/77158#discussion_r4612191296


##########
providers/amazon/src/airflow/providers/amazon/aws/operators/batch.py:
##########
@@ -363,6 +368,40 @@ def submit_job(self, context: Context):
             aws_partition=self.hook.conn_partition,
             job_id=self.job_id,
         )
+        return self.job_id
+
+    def get_job_status(self, external_id: JsonValue, context: Context) -> str:
+        jobs = self.hook.client.describe_jobs(jobs=[cast("str", 
external_id)])["jobs"]
+        return jobs[0]["status"] if jobs else "NOT_FOUND"
+
+    def is_job_active(self, status: str) -> bool:
+        return status in self.hook.INTERMEDIATE_STATES
+
+    def is_job_succeeded(self, status: str) -> bool:
+        return status == self.hook.SUCCESS_STATE
+
+    def poll_until_complete(self, external_id: JsonValue, context: Context) -> 
None:
+        self._attach_to_job(external_id, context)
+        if self.wait_for_completion:
+            self.monitor_job(context)
+
+    def get_job_result(self, external_id: JsonValue, context: Context) -> str 
| None:
+        self._attach_to_job(external_id, context)
+        return self.job_id
+
+    def _attach_to_job(self, external_id: JsonValue, context: Context) -> None:
+        # None comes from subclasses whose submit_job override predates it 
returning the job id;
+        # they still set self.job_id, so keep it.

Review Comment:
   Nice, added a warning in `_attach_to_job` when `submit_job` returns no job 
id. The legacy subclass test checks for it.
   
   



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