pankajkoti commented on code in PR #36685:
URL: https://github.com/apache/airflow/pull/36685#discussion_r1471079764


##########
airflow/providers/amazon/aws/operators/sagemaker.py:
##########
@@ -1085,8 +1089,50 @@ def execute(self, context: Context) -> dict:
             raise AirflowException(f"Sagemaker Training Job creation failed: 
{response}")
 
         if self.deferrable and self.wait_for_completion:
+            description = 
self.hook.describe_training_job(self.config["TrainingJobName"])
+            status = description["TrainingJobStatus"]
+
+            if self.print_log:
+                instance_count = description["ResourceConfig"]["InstanceCount"]
+                last_describe_job_call = time.monotonic()
+                job_already_completed = status not in 
self.hook.non_terminal_states
+                _, last_description, last_describe_job_call = 
self.hook.describe_training_job_with_log(
+                    self.config["TrainingJobName"],
+                    {},
+                    [],
+                    instance_count,
+                    LogState.TAILING if job_already_completed else 
LogState.COMPLETE,

Review Comment:
   I was thinking if the condition should be other way round. Tail the logs 
while the job is not complete and if complete then set LogState.Complete.



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