Skip to content

Commit a421487

Browse files
athewseyajaykarpur
andauthored
feature: warn on 'Stopped' (non-Completed) jobs (#2000)
Jobs ending with status "Stopped" rather than "Completed" are likely to have been terminated in non-happy-path: e.g. aborted or stopped early. Warn users to check results in this case. Co-authored-by: Ajay Karpur <[email protected]>
1 parent 8dd3247 commit a421487

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/sagemaker/session.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3121,7 +3121,13 @@ def _check_job_status(self, job, desc, status_key_name):
31213121
# If the status is capital case, then convert it to Camel case
31223122
status = _STATUS_CODE_TABLE.get(status, status)
31233123

3124-
if status not in ("Completed", "Stopped"):
3124+
if status == "Stopped":
3125+
LOGGER.warning(
3126+
"Job ended with status 'Stopped' rather than 'Completed'. "
3127+
"This could mean the job timed out or stopped early for some other reason: "
3128+
"Consider checking whether it completed as you expect."
3129+
)
3130+
elif status != "Completed":
31253131
reason = desc.get("FailureReason", "(No reason provided)")
31263132
job_type = status_key_name.replace("JobStatus", " job")
31273133
raise exceptions.UnexpectedStatusException(

0 commit comments

Comments
 (0)