Skip to content

Commit 5199b7e

Browse files
mvsuspDan
authored andcommitted
fix: paginating describe log streams (#1046)
1 parent 5bba595 commit 5199b7e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/sagemaker/session.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1985,9 +1985,20 @@ def _flush_log_streams(
19851985
logGroupName=log_group,
19861986
logStreamNamePrefix=job_name + "/",
19871987
orderBy="LogStreamName",
1988-
limit=instance_count,
1988+
limit=min(instance_count, 50),
19891989
)
19901990
stream_names = [s["logStreamName"] for s in streams["logStreams"]]
1991+
1992+
while "nextToken" in streams:
1993+
streams = client.describe_log_streams(
1994+
logGroupName=log_group,
1995+
logStreamNamePrefix=job_name + "/",
1996+
orderBy="LogStreamName",
1997+
limit=50,
1998+
)
1999+
2000+
stream_names.extend([s["logStreamName"] for s in streams["logStreams"]])
2001+
19912002
positions.update(
19922003
[
19932004
(s, sagemaker.logs.Position(timestamp=0, skip=0))

0 commit comments

Comments
 (0)