Skip to content

Commit b055a67

Browse files
committed
feature: warn on 'Stopped' (non-Completed) jobs
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.
1 parent e8d16f8 commit b055a67

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
@@ -2946,7 +2946,13 @@ def _check_job_status(self, job, desc, status_key_name):
29462946
# If the status is capital case, then convert it to Camel case
29472947
status = _STATUS_CODE_TABLE.get(status, status)
29482948

2949-
if status not in ("Completed", "Stopped"):
2949+
if status == "Stopped":
2950+
LOGGER.warning(
2951+
"Job ended with status 'Stopped' rather than 'Completed'. "
2952+
"This could mean the job timed out or stopped early for some other reason: "
2953+
"Consider checking whether it completed as you expect."
2954+
)
2955+
elif status != "Completed":
29502956
reason = desc.get("FailureReason", "(No reason provided)")
29512957
job_type = status_key_name.replace("JobStatus", " job")
29522958
raise exceptions.UnexpectedStatusException(

0 commit comments

Comments
 (0)