Skip to content

Commit

Permalink
Refresh local aws images.csv when image not found (#4127)
Browse files Browse the repository at this point in the history
Refresh local aws images.csv by pulling from github catalog when image tag not found
  • Loading branch information
yika-luo authored Oct 18, 2024
1 parent 71a95f4 commit 7971aa2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion sky/clouds/service_catalog/aws_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,17 @@ 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)
global _image_df

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:
Expand Down

0 comments on commit 7971aa2

Please sign in to comment.