-
Notifications
You must be signed in to change notification settings - Fork 1.2k
change: separate logs() from attach() #1708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
7acdbc4
c5dafc5
17610e0
35c3daa
612ae57
3e3d8b9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -630,9 +630,15 @@ def attach(cls, training_job_name, sagemaker_session=None, model_channel_name="m | |
sagemaker_session=sagemaker_session, job_name=training_job_name | ||
) | ||
estimator._current_job_name = estimator.latest_training_job.name | ||
estimator.latest_training_job.wait() | ||
estimator.latest_training_job.wait(logs="None") | ||
return estimator | ||
|
||
def logs(self): | ||
"""Display the logs for Estimator's training job. If the output is a tty or a Jupyter | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit pep-0257: single line, continue with detail after blank line |
||
cell, it will be color-coded based on which instance the log entry is from. | ||
""" | ||
self.sagemaker_session.logs_for_job(self.latest_training_job, wait=True) | ||
|
||
def deploy( | ||
self, | ||
initial_instance_count, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -681,6 +681,27 @@ def test_attach_framework(sagemaker_session): | |
assert framework_estimator.enable_network_isolation() is True | ||
|
||
|
||
def test_attach_no_logs(sagemaker_session): | ||
returned_job_description = RETURNED_JOB_DESCRIPTION.copy() | ||
mock_describe_training_job = Mock( | ||
name="describe_training_job", return_value=returned_job_description | ||
) | ||
sagemaker_session.sagemaker_client.describe_training_job = mock_describe_training_job | ||
Estimator.attach(training_job_name="job", sagemaker_session=sagemaker_session) | ||
sagemaker_session.logs_for_job.assert_not_called() | ||
|
||
|
||
def test_logs(sagemaker_session): | ||
returned_job_description = RETURNED_JOB_DESCRIPTION.copy() | ||
mock_describe_training_job = Mock( | ||
name="describe_training_job", return_value=returned_job_description | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this an opportunity for a fixture? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea, there are in total 5 tests using this training job description |
||
sagemaker_session.sagemaker_client.describe_training_job = mock_describe_training_job | ||
estimator = Estimator.attach(training_job_name="job", sagemaker_session=sagemaker_session) | ||
estimator.logs() | ||
sagemaker_session.logs_for_job.assert_called_with(estimator.latest_training_job, wait=True) | ||
|
||
|
||
def test_attach_without_hyperparameters(sagemaker_session): | ||
returned_job_description = RETURNED_JOB_DESCRIPTION.copy() | ||
del returned_job_description["HyperParameters"] | ||
|
Uh oh!
There was an error while loading. Please reload this page.