Skip to content

Commit

Permalink
Refresh local aws images.csv by pulling from github catalog when imag…
Browse files Browse the repository at this point in the history
…e tag not found
  • Loading branch information
yika-luo committed Oct 18, 2024
1 parent 71a95f4 commit 9a8a2c3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions sky/clouds/service_catalog/aws_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,15 @@ def list_accelerators(

def get_image_id_from_tag(tag: str, region: Optional[str]) -> Optional[str]:
"""Returns the image id from the tag."""
return common.get_image_id_from_tag_impl(_image_df, tag, region)

image_id = common.get_image_id_from_tag_impl(_image_df, tag, region)
if image_id is None:
# Refresh the image catalog and try again, if the image tag is not
# found.
logger.debug('Refreshing the image catalog and trying again.')
_image_df = common.read_catalog('aws/images.csv',
pull_frequency_hours=0)
image_id = common.get_image_id_from_tag_impl(_image_df, tag, region)
return image_id

def is_image_tag_valid(tag: str, region: Optional[str]) -> bool:
"""Returns whether the image tag is valid."""
Expand Down

0 comments on commit 9a8a2c3

Please sign in to comment.