Skip to content

Commit f8ed1f1

Browse files
[Storage] Add CloudImplementationFeature for Storage Mounting (#3389)
* prevent single cloud from blocking `sky check` * add storage_mounting feature * lint * lint * rename * comment * lint
1 parent c7e6bee commit f8ed1f1

File tree

4 files changed

+32
-3
lines changed

4 files changed

+32
-3
lines changed

sky/clouds/cloud.py

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class CloudImplementationFeatures(enum.Enum):
4141
SPOT_INSTANCE = 'spot_instance'
4242
CUSTOM_DISK_TIER = 'custom_disk_tier'
4343
OPEN_PORTS = 'open_ports'
44+
STORAGE_MOUNTING = 'storage_mounting'
4445

4546

4647
class Region(collections.namedtuple('Region', ['name'])):

sky/clouds/runpod.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ class RunPod(clouds.Cloud):
3838
clouds.CloudImplementationFeatures.DOCKER_IMAGE:
3939
(f'Docker image is currently not supported on {_REPR}.'),
4040
clouds.CloudImplementationFeatures.CUSTOM_DISK_TIER:
41-
('Customizing disk tier is not supported yet on RunPod.')
41+
('Customizing disk tier is not supported yet on RunPod.'),
42+
clouds.CloudImplementationFeatures.STORAGE_MOUNTING:
43+
('Mounting object stores is not supported on RunPod. To read data '
44+
'from object stores on RunPod, use `mode: COPY` to copy the data '
45+
'to local disk.'),
4246
}
4347
_MAX_CLUSTER_NAME_LEN_LIMIT = 120
4448
_regions: List[clouds.Region] = []

sky/execution.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ def _execute(
234234
# Requested features that some clouds support and others don't.
235235
requested_features = set()
236236

237-
if task.num_nodes > 1:
238-
requested_features.add(clouds.CloudImplementationFeatures.MULTI_NODE)
237+
# Add requested features from the task
238+
requested_features |= task.get_required_cloud_features()
239239

240240
backend = backend if backend is not None else backends.CloudVmRayBackend()
241241
if isinstance(backend, backends.CloudVmRayBackend):

sky/task.py

+24
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,30 @@ def add_if_not_none(key, value, no_empty: bool = False):
10661066
})
10671067
return config
10681068

1069+
def get_required_cloud_features(
1070+
self) -> Set[clouds.CloudImplementationFeatures]:
1071+
"""Returns the required features for this task (but not for resources).
1072+
1073+
Features required by the resources are checked separately in
1074+
cloud.get_feasible_launchable_resources().
1075+
1076+
INTERNAL: this method is internal-facing.
1077+
"""
1078+
required_features = set()
1079+
1080+
# Multi-node
1081+
if self.num_nodes > 1:
1082+
required_features.add(clouds.CloudImplementationFeatures.MULTI_NODE)
1083+
1084+
# Storage mounting
1085+
for _, storage_mount in self.storage_mounts.items():
1086+
if storage_mount.mode == storage_lib.StorageMode.MOUNT:
1087+
required_features.add(
1088+
clouds.CloudImplementationFeatures.STORAGE_MOUNTING)
1089+
break
1090+
1091+
return required_features
1092+
10691093
def __rshift__(self, b):
10701094
sky.dag.get_current_dag().add_edge(self, b)
10711095

0 commit comments

Comments
 (0)