You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Lee-W (via GitHub)" <gi...@apache.org> on 2024/02/01 02:53:33 UTC
Re: [PR] check sagemaker training job status before deferring SageMakerTrainingOperator [airflow]
Lee-W commented on code in PR #36685:
URL: https://github.com/apache/airflow/pull/36685#discussion_r1473735134
##########
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:
yep, thanks for the reminder. fixed 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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org