Skip to content

Commit

Permalink
potential fix due to faulty prefix for s3
Browse files Browse the repository at this point in the history
Signed-off-by: Duncan Ragsdale <[email protected]>
  • Loading branch information
Thistleman committed Nov 29, 2023
1 parent de11ab2 commit 79f0284
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions workers/submission_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ def list_s3_bucket(s3_dir):
for entry in ret['Contents']:
all_files.append(os.path.join(s3_dir.split('/')[0], entry['Key']))
else:
logger.info(f'list s3 bucket {s3_dir_full_path}')
# check s3_dir string to see if it contains "pv-validation-hub-bucket/"
# if so, remove it
s3_dir = s3_dir.replace('pv-validation-hub-bucket/', '')
logger.info(f'dir after removing pv-validation-hub-bucket/ returns {s3_dir}')

s3 = boto3.client('s3')
paginator = s3.get_paginator('list_objects_v2')
pages = paginator.paginate(Bucket=S3_BUCKET_NAME, Prefix=s3_dir)
Expand All @@ -129,7 +133,7 @@ def list_s3_bucket(s3_dir):
for entry in page['Contents']:
all_files.append(entry['Key'])

logger.info(f'list s3 bucket {s3_dir_full_path} returns {all_files}')
logger.info(f'listed s3 bucket {s3_dir_full_path} returns {all_files}')
return all_files


Expand Down

0 comments on commit 79f0284

Please sign in to comment.