Lee-W commented on code in PR #32534:
URL: https://github.com/apache/airflow/pull/32534#discussion_r1265499110


##########
airflow/providers/amazon/aws/operators/emr.py:
##########
@@ -1227,6 +1256,39 @@ def execute(self, context: Context) -> str | None:
 
         return self.job_id
 
+    def start_job_run_after_defer(self, context: Context, event: dict[str, 
Any] = {}) -> None:

Review Comment:
   It's suggested not to use mutable objects such as `{}` as the default value.



##########
airflow/providers/amazon/aws/operators/emr.py:
##########
@@ -1227,6 +1256,39 @@ def execute(self, context: Context) -> str | None:
 
         return self.job_id
 
+    def start_job_run_after_defer(self, context: Context, event: dict[str, 
Any] = {}) -> None:
+        if event["status"] != "success":
+            self.log.info("Application %s failed to start", 
self.application_id)
+        response = self.hook.conn.start_job_run(
+            clientToken=self.client_request_token,
+            applicationId=self.application_id,
+            executionRoleArn=self.execution_role_arn,
+            jobDriver=self.job_driver,
+            configurationOverrides=self.configuration_overrides,
+            name=self.name,
+            **self.config,
+        )
+
+        if response["ResponseMetadata"]["HTTPStatusCode"] != 200:
+            raise AirflowException(f"EMR serverless job failed to start: 
{response}")
+
+        self.defer(
+            trigger=EmrServerlessStartJobTrigger(
+                application_id=self.application_id,
+                job_id=response["jobRunId"],
+                waiter_delay=self.waiter_delay,
+                waiter_max_attempts=self.waiter_max_attempts,
+                aws_conn_id=self.aws_conn_id,
+            ),
+            method_name="execute_complete",
+            timeout=timedelta(seconds=self.waiter_max_attempts * 
self.waiter_delay),
+        )
+
+    def execute_complete(self, context: Context, event: dict[str, Any] = {}) 
-> None:

Review Comment:
   
   
   It's suggested not to use mutable objects such as {} as the default value.
   



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