Skip to content

Commit

Permalink
[Storage] Add CloudImplementationFeature for Storage Mounting (#3389)
Browse files Browse the repository at this point in the history
* prevent single cloud from blocking `sky check`

* add storage_mounting feature

* lint

* lint

* rename

* comment

* lint
  • Loading branch information
romilbhardwaj authored Mar 29, 2024
1 parent c7e6bee commit f8ed1f1
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
1 change: 1 addition & 0 deletions sky/clouds/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class CloudImplementationFeatures(enum.Enum):
SPOT_INSTANCE = 'spot_instance'
CUSTOM_DISK_TIER = 'custom_disk_tier'
OPEN_PORTS = 'open_ports'
STORAGE_MOUNTING = 'storage_mounting'


class Region(collections.namedtuple('Region', ['name'])):
Expand Down
6 changes: 5 additions & 1 deletion sky/clouds/runpod.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ class RunPod(clouds.Cloud):
clouds.CloudImplementationFeatures.DOCKER_IMAGE:
(f'Docker image is currently not supported on {_REPR}.'),
clouds.CloudImplementationFeatures.CUSTOM_DISK_TIER:
('Customizing disk tier is not supported yet on RunPod.')
('Customizing disk tier is not supported yet on RunPod.'),
clouds.CloudImplementationFeatures.STORAGE_MOUNTING:
('Mounting object stores is not supported on RunPod. To read data '
'from object stores on RunPod, use `mode: COPY` to copy the data '
'to local disk.'),
}
_MAX_CLUSTER_NAME_LEN_LIMIT = 120
_regions: List[clouds.Region] = []
Expand Down
4 changes: 2 additions & 2 deletions sky/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ def _execute(
# Requested features that some clouds support and others don't.
requested_features = set()

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

backend = backend if backend is not None else backends.CloudVmRayBackend()
if isinstance(backend, backends.CloudVmRayBackend):
Expand Down
24 changes: 24 additions & 0 deletions sky/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,30 @@ def add_if_not_none(key, value, no_empty: bool = False):
})
return config

def get_required_cloud_features(
self) -> Set[clouds.CloudImplementationFeatures]:
"""Returns the required features for this task (but not for resources).
Features required by the resources are checked separately in
cloud.get_feasible_launchable_resources().
INTERNAL: this method is internal-facing.
"""
required_features = set()

# Multi-node
if self.num_nodes > 1:
required_features.add(clouds.CloudImplementationFeatures.MULTI_NODE)

# Storage mounting
for _, storage_mount in self.storage_mounts.items():
if storage_mount.mode == storage_lib.StorageMode.MOUNT:
required_features.add(
clouds.CloudImplementationFeatures.STORAGE_MOUNTING)
break

return required_features

def __rshift__(self, b):
sky.dag.get_current_dag().add_edge(self, b)

Expand Down

0 comments on commit f8ed1f1

Please sign in to comment.