Skip to content

Commit

Permalink
[Cudo] Allow opening ports for cudo (#3717)
Browse files Browse the repository at this point in the history
* Allow opening ports for cudo

* fix logging

* format

* Avoid host controller for cudo

* install cudoctl on controller

* fix cudoctl installation

* update cudo controller message
  • Loading branch information
Michaelvll authored Jul 4, 2024
1 parent f0f4de8 commit f7cd5ad
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
4 changes: 4 additions & 0 deletions sky/clouds/cudo.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ class Cudo(clouds.Cloud):
clouds.CloudImplementationFeatures.DOCKER_IMAGE:
('Docker image is currently not supported on Cudo. You can try '
'running docker command inside the `run` section in task.yaml.'),
clouds.CloudImplementationFeatures.HOST_CONTROLLERS: (
'Cudo Compute cannot host a controller as it does not '
'autostopping, which will leave the controller to run indefinitely.'
),
}
_MAX_CLUSTER_NAME_LEN_LIMIT = 60

Expand Down
3 changes: 2 additions & 1 deletion sky/provision/cudo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from sky.provision.cudo.config import bootstrap_instances
from sky.provision.cudo.instance import cleanup_ports
from sky.provision.cudo.instance import get_cluster_info
from sky.provision.cudo.instance import open_ports
from sky.provision.cudo.instance import query_instances
from sky.provision.cudo.instance import run_instances
from sky.provision.cudo.instance import stop_instances
Expand All @@ -11,4 +12,4 @@

__all__ = ('bootstrap_instances', 'run_instances', 'stop_instances',
'terminate_instances', 'wait_instances', 'get_cluster_info',
'cleanup_ports', 'query_instances')
'cleanup_ports', 'query_instances', 'open_ports')
15 changes: 12 additions & 3 deletions sky/provision/cudo/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,10 @@ def terminate_instances(
del provider_config
instances = _filter_instances(cluster_name_on_cloud, None)
for inst_id, inst in instances.items():
logger.info(f'Terminating instance {inst_id}.'
f'{inst}')
if worker_only and inst['name'].endswith('-head'):
continue
logger.info(f'Removing {inst_id}: {inst}')
logger.debug(f'Terminating Cudo instance {inst_id}.'
f'{inst}')
cudo_wrapper.remove(inst_id)


Expand Down Expand Up @@ -220,6 +219,16 @@ def query_instances(
return statuses


def open_ports(
cluster_name_on_cloud: str,
ports: List[str],
provider_config: Optional[Dict[str, Any]] = None,
) -> None:
del cluster_name_on_cloud, ports, provider_config
# Cudo has all ports open by default. Nothing to do here.
return


def cleanup_ports(
cluster_name_on_cloud: str,
ports: List[str],
Expand Down
13 changes: 7 additions & 6 deletions sky/utils/controller_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,13 @@ def _get_cloud_dependencies_installation_commands(
'/bin/linux/amd64/kubectl" && '
'sudo install -o root -g root -m 0755 '
'kubectl /usr/local/bin/kubectl))')
elif isinstance(cloud, clouds.Cudo):
commands.append(
f'echo -en "\\r{prefix_str}Cudo{empty_str}" && '
'pip list | grep cudo-compute > /dev/null 2>&1 || '
'pip install "cudo-compute>=0.1.10" > /dev/null 2>&1 && '
'wget https://download.cudo.org/compute/cudoctl-0.3.2-amd64.deb -O ~/cudoctl.deb > /dev/null 2>&1 && ' # pylint: disable=line-too-long
'sudo dpkg -i ~/cudoctl.deb > /dev/null 2>&1')
if controller == Controllers.JOBS_CONTROLLER:
if isinstance(cloud, clouds.IBM):
commands.append(
Expand All @@ -263,12 +270,6 @@ def _get_cloud_dependencies_installation_commands(
f'echo -en "\\r{prefix_str}RunPod{empty_str}" && '
'pip list | grep runpod > /dev/null 2>&1 || '
'pip install "runpod>=1.5.1" > /dev/null 2>&1')
elif isinstance(cloud, clouds.Cudo):
# cudo doesn't support open port
commands.append(
f'echo -en "\\r{prefix_str}Cudo{empty_str}" && '
'pip list | grep cudo-compute > /dev/null 2>&1 || '
'pip install "cudo-compute>=0.1.8" > /dev/null 2>&1')
if (cloudflare.NAME
in storage_lib.get_cached_enabled_storage_clouds_or_refresh()):
commands.append(f'echo -en "\\r{prefix_str}Cloudflare{empty_str}" && ' +
Expand Down

0 comments on commit f7cd5ad

Please sign in to comment.