feature: warn on 'Stopped' (non-Completed) jobs #2000
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #, if available: #1937
Description of changes:
Jobs ending with status "Stopped" rather than "Completed" now trigger a warning, because they're likely to have been terminated in a non-happy-path (e.g. aborted or stopped early).
As discussed on the associated issue, a user typically needs to have taken actual conscious steps (e.g. saving intermediate output) for a job terminating in this way to be considered successful: So warning as default behaviour should help to protect less-experienced users.
Some caveats / possible points of feedback:
_check_job_status()
function because, as far as I've been able to ascertain, this significance appears to be shared between the different types of jobs it's shared between (which includes AutoML, Training, Processing, Compilation, HyperParameterTuning, Transform).LOGGER.warning()
to show a warning message, notwarnings.warn
(a pattern which is already used in some other places) - but I couldn't see any existing test tooling to assert on this: Just tests likewith pytest.warns(UserWarning):
which seem to work with thewarnings
module only. Open to the idea of using the warnings module instead, but I think the default filter behaviour would be different? (Showing once only vs showing each triggered warning).Testing done:
Verified the unit tests run, and imported the modified library in SageMaker (Studio) notebook to check manually that attaching to
Stopped
jobs triggers a visible warning as expected.Merge Checklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.General
I have passed the region in to all S3 and STS clients that I've initialized as part of this change.I have updated any necessary documentation, including READMEs and API docs (if appropriate)Tests
I have added tests that prove my fix is effective or that my feature works (if appropriate)I have checked that my tests are not configured for a specific region or account (if appropriate)I have usedunique_name_from_base
to create resource names in integ tests (if appropriate)By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.