Skip to content

describing training job call every 30 seconds #10

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

Merged
merged 2 commits into from
Dec 7, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/sagemaker/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ def logs_for_job(self, job_name, wait=False, poll=5): # noqa: C901 - suppress c
# Notes:
# - The JOB_COMPLETE state forces us to do an extra pause and read any items that got to Cloudwatch after
# the job was marked complete.

seconds_since_last_describe_job_call = 30
while True:
if len(stream_names) < instance_count:
# Log streams are created whenever a container starts writing to stdout/err, so this list
Expand Down Expand Up @@ -645,8 +645,12 @@ def logs_for_job(self, job_name, wait=False, poll=5): # noqa: C901 - suppress c

if state == LogState.JOB_COMPLETE:
state = LogState.COMPLETE
elif seconds_since_last_describe_job_call < 30:
seconds_since_last_describe_job_call += max(poll, 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use actual seconds (from time.time()) instead of this pseudo-time counter?

else:
description = self.sagemaker_client.describe_training_job(TrainingJobName=job_name)
seconds_since_last_describe_job_call = 0

status = description['TrainingJobStatus']

if status == 'Completed' or status == 'Failed':
Expand Down