Skip to content

Commit

Permalink
fix: paginating describe log streams (#1046)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvsusp authored and Dan committed Oct 9, 2019
1 parent 5bba595 commit 5199b7e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/sagemaker/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -1985,9 +1985,20 @@ def _flush_log_streams(
logGroupName=log_group,
logStreamNamePrefix=job_name + "/",
orderBy="LogStreamName",
limit=instance_count,
limit=min(instance_count, 50),
)
stream_names = [s["logStreamName"] for s in streams["logStreams"]]

while "nextToken" in streams:
streams = client.describe_log_streams(
logGroupName=log_group,
logStreamNamePrefix=job_name + "/",
orderBy="LogStreamName",
limit=50,
)

stream_names.extend([s["logStreamName"] for s in streams["logStreams"]])

positions.update(
[
(s, sagemaker.logs.Position(timestamp=0, skip=0))
Expand Down

0 comments on commit 5199b7e

Please sign in to comment.