Skip to content

Commit

Permalink
corrected boto3 issues causing key errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Thistleman committed Nov 9, 2023
1 parent 26e89ca commit 677ba4e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
6 changes: 1 addition & 5 deletions valhub/base/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,7 @@ def upload_to_s3_bucket(bucket_name, local_path, upload_path):
return s3_file_full_path.replace('http://s3:5000/put_object/', 'http://s3:5000/get_object/')
else:
"""Upload file to S3 bucket and return object URL"""
s3 = boto3.client(
's3',
aws_access_key_id=os.environ["AWS_ACCESS_KEY_ID"],
aws_secret_access_key=os.environ["AWS_SECRET_ACCESS_KEY"]
)
s3 = boto3.client('s3')

try:
s3.upload_file(local_path, bucket_name, upload_path)
Expand Down
6 changes: 0 additions & 6 deletions workers/submission_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,6 @@ def download_and_extract_zip_file(file_name, download_location, extract_location
s3 = boto3.client(
's3',
region_name=os.environ.get("AWS_DEFAULT_REGION", "us-west-2"),
aws_access_key_id=os.environ["AWS_ACCESS_KEY_ID"],
aws_secret_access_key=os.environ["AWS_SECRET_ACCESS_KEY"]
)
s3.download_file(S3_BUCKET_NAME, file_name, download_location)
except Exception as e:
Expand Down Expand Up @@ -595,8 +593,6 @@ def get_or_create_sqs_queue(queue_name):
sqs = boto3.resource(
"sqs",
region_name=os.environ.get("AWS_DEFAULT_REGION", "us-west-2"),
aws_secret_access_key=os.environ.get("AWS_SECRET_ACCESS_KEY"),
aws_access_key_id=os.environ.get("AWS_ACCESS_KEY_ID"),
)

if queue_name == "":
Expand All @@ -623,8 +619,6 @@ def get_analysis_pk():
ec2_resource = boto3.resource(
'ec2',
region_name=os.environ.get("AWS_DEFAULT_REGION", "us-west-2"),
aws_secret_access_key=os.environ.get("AWS_SECRET_ACCESS_KEY"),
aws_access_key_id=os.environ.get("AWS_ACCESS_KEY_ID"),
)
ec2_instance = ec2_resource.Instance(instance_id)
tags = ec2_instance.tags
Expand Down

0 comments on commit 677ba4e

Please sign in to comment.