Skip to content

Commit 14e7265

Browse files
committed
[Storage] Avoid opt-in regions for S3 (#4239)
* S3 fix + timeout * S3 fix + timeout * lint (cherry picked from commit bf17e87)
1 parent c4eeeb5 commit 14e7265

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

sky/data/storage.py

+17-2
Original file line numberDiff line numberDiff line change
@@ -1082,16 +1082,31 @@ class S3Store(AbstractStore):
10821082
for S3 buckets.
10831083
"""
10841084

1085+
_DEFAULT_REGION = 'us-east-1'
10851086
_ACCESS_DENIED_MESSAGE = 'Access Denied'
1087+
_CUSTOM_ENDPOINT_REGIONS = [
1088+
'ap-east-1', 'me-south-1', 'af-south-1', 'eu-south-1', 'eu-south-2',
1089+
'ap-south-2', 'ap-southeast-3', 'ap-southeast-4', 'me-central-1',
1090+
'il-central-1'
1091+
]
10861092

10871093
def __init__(self,
10881094
name: str,
10891095
source: str,
1090-
region: Optional[str] = 'us-east-2',
1096+
region: Optional[str] = _DEFAULT_REGION,
10911097
is_sky_managed: Optional[bool] = None,
10921098
sync_on_reconstruction: bool = True):
10931099
self.client: 'boto3.client.Client'
10941100
self.bucket: 'StorageHandle'
1101+
# TODO(romilb): This is purely a stopgap fix for
1102+
# https://github.com/skypilot-org/skypilot/issues/3405
1103+
# We should eventually make all opt-in regions also work for S3 by
1104+
# passing the right endpoint flags.
1105+
if region in self._CUSTOM_ENDPOINT_REGIONS:
1106+
logger.warning('AWS opt-in regions are not supported for S3. '
1107+
f'Falling back to default region '
1108+
f'{self._DEFAULT_REGION} for bucket {name!r}.')
1109+
region = self._DEFAULT_REGION
10951110
super().__init__(name, source, region, is_sky_managed,
10961111
sync_on_reconstruction)
10971112

@@ -1424,7 +1439,7 @@ def mount_command(self, mount_path: str) -> str:
14241439

14251440
def _create_s3_bucket(self,
14261441
bucket_name: str,
1427-
region='us-east-2') -> StorageHandle:
1442+
region=_DEFAULT_REGION) -> StorageHandle:
14281443
"""Creates S3 bucket with specific name in specific region
14291444
14301445
Args:

tests/test_smoke.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3039,7 +3039,7 @@ def test_managed_jobs_cancellation_aws(aws_config_region):
30393039
# Test cancellation during spot cluster being launched.
30403040
f'sky jobs launch --cloud aws --region {region} -n {name} --use-spot "sleep 1000" -y -d',
30413041
'sleep 60',
3042-
f'{_GET_JOB_QUEUE} | grep {name} | head -n1 | grep "STARTING"',
3042+
f'{_GET_JOB_QUEUE} | grep {name} | head -n1 | grep "STARTING\|RUNNING"',
30433043
f'sky jobs cancel -y -n {name}',
30443044
'sleep 5',
30453045
f'{_GET_JOB_QUEUE} | grep {name} | head -n1 | grep "CANCELLING\|CANCELLED"',

0 commit comments

Comments
 (0)