dominikhei commented on code in PR #51883:
URL: https://github.com/apache/airflow/pull/51883#discussion_r2155005263


##########
providers/amazon/src/airflow/providers/amazon/aws/hooks/emr.py:
##########
@@ -311,6 +311,24 @@ def cancel_running_jobs(
 
         return count
 
+    def cancel_job(self, application_id: str, job_run_id: str) -> None:
+        """
+        Cancel a specific EMR Serverless job run.
+
+        :param application_id: The ID of the EMR Serverless application
+        :param job_run_id: The ID of the job run to cancel
+        :raises AirflowException: If cancellation fails
+        """
+        try:
+            self.log.info("Cancelling EMR Serverless job %s in application 
%s", job_run_id, application_id)
+            response = self.conn.cancel_job_run(applicationId=application_id, 
jobRunId=job_run_id)
+            http_code = response["ResponseMetadata"]["HTTPStatusCode"]
+            if http_code != 200:
+                raise AirflowException(f"Failed to cancel job run 
{job_run_id}: HTTP {http_code}")

Review Comment:
   Makes total sense, thanks. I also used the boto3 one in my operator. 



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