Skip to content

Commit

Permalink
fix: use separate aws session for python validation (#745)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajberdy authored Oct 16, 2023
1 parent 120d7d2 commit 06a9935
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/braket/jobs/hybrid_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ def hybrid_job(
logger (Logger): Logger object with which to write logs, such as task statuses
while waiting for task to be in a terminal state. Default is `getLogger(__name__)`
"""
aws_session = aws_session or AwsSession()
_validate_python_version(aws_session, image_uri)
_validate_python_version(image_uri, aws_session)

def _hybrid_job(entry_point):
@functools.wraps(entry_point)
Expand Down Expand Up @@ -209,8 +208,9 @@ def job_wrapper(*args, **kwargs):
return _hybrid_job


def _validate_python_version(aws_session: AwsSession, image_uri: str | None):
def _validate_python_version(image_uri: str | None, aws_session: AwsSession | None = None):
"""Validate python version at job definition time"""
aws_session = aws_session or AwsSession()
# user provides a custom image_uri
if image_uri and image_uri not in built_in_images(aws_session.region):
print(
Expand Down

0 comments on commit 06a9935

Please sign in to comment.