Skip to content

Commit

Permalink
Change cray artifacts to return more than 1000 files (CASMPET-6168)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brad Klein authored and bklei committed Jul 6, 2023
1 parent 2a9c6a8 commit ca43f34
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cray/modules/artifacts/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,15 @@ def list_objects(ctx, bucket):
# Load config to make sure it exists.
s3client = get_s3_client()
try:
files = s3client.list_objects(Bucket=bucket).get('Contents', [])
files = []
paginator = s3client.get_paginator('list_objects')
pages = paginator.paginate(Bucket=bucket)

for page in pages:
if 'Contents' in page:
for obj in page['Contents']:
files.append(obj)

except (s3client.exceptions.NoSuchBucket, ClientError) as err:
sys.exit(str(err))
return {
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ dependencies = [
'boto3<1.24',
'botocore<1.27',
# DO NOT UPDATE the above boto3 and botocore - Breaks cray artifacts bucket list
# DO NOT UPDATE the below urllib3 - Breaks cray artifacts list <bucket> pagination
# https://github.com/boto/botocore/issues/2926
'urllib3>=1.25.4,<1.27',
# DO NOT UPDATE the above urllib3 - Breaks cray artifacts list <bucket> pagination
'click==7.1.2',
'oauthlib~=3.2',
'requests-oauthlib~=1.3',
Expand Down

0 comments on commit ca43f34

Please sign in to comment.