-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update some release tests to use den launcher
- Loading branch information
Alexandra Belousov
authored and
Alexandra Belousov
committed
Dec 9, 2024
1 parent
e9f2036
commit 153dc8e
Showing
3 changed files
with
82 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,77 @@ | ||
from enum import Enum | ||
from typing import Union | ||
|
||
import pytest | ||
|
||
import runhouse as rh | ||
from runhouse.resources.hardware.utils import LauncherType | ||
|
||
from tests.conftest import init_args | ||
from tests.utils import test_env | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def static_cpu_pwd_cluster(): | ||
sky_cluster = rh.cluster( | ||
"aws-cpu-password", instance_type="CPU:4", provider="aws" | ||
class computeType(str, Enum): | ||
cpu = "cpu" | ||
gpu = "gpu" | ||
|
||
|
||
def setup_static_cluster( | ||
launcher: Union[LauncherType, str] = None, | ||
compute_type: computeType = computeType.cpu, | ||
): | ||
instance_type = "CPU:4" if compute_type == computeType.cpu else "g5.xlarge" | ||
cluster = rh.cluster( | ||
f"aws-{compute_type}-password", | ||
instance_type=instance_type, | ||
provider="aws", | ||
launcher=launcher, | ||
).save() | ||
if not sky_cluster.is_up(): | ||
sky_cluster.up() | ||
if not cluster.is_up(): | ||
cluster.up() | ||
|
||
# set up password on remote | ||
sky_cluster.run( | ||
cluster.run( | ||
[ | ||
[ | ||
'sudo sed -i "/^[^#]*PasswordAuthentication[[:space:]]no/c\PasswordAuthentication yes" ' | ||
"/etc/ssh/sshd_config" | ||
] | ||
] | ||
) | ||
sky_cluster.run(["sudo /etc/init.d/ssh force-reload"]) | ||
sky_cluster.run(["sudo /etc/init.d/ssh restart"]) | ||
sky_cluster.run( | ||
cluster.run(["sudo /etc/init.d/ssh force-reload"]) | ||
cluster.run(["sudo /etc/init.d/ssh restart"]) | ||
cluster.run( | ||
["(echo 'cluster-pass' && echo 'cluster-pass') | sudo passwd ubuntu"] | ||
) | ||
sky_cluster.run(["pip uninstall skypilot runhouse -y", "pip install pytest"]) | ||
sky_cluster.run(["rm -rf runhouse/"]) | ||
cluster.run(["pip uninstall skypilot runhouse -y", "pip install pytest"]) | ||
cluster.run(["rm -rf runhouse/"]) | ||
|
||
# instantiate byo cluster with password | ||
ssh_creds = { | ||
"ssh_user": "ubuntu", | ||
"ssh_private_key": "~/.ssh/sky-key", | ||
"password": "cluster-pass", | ||
} | ||
args = dict( | ||
name="static-cpu-password", host=[sky_cluster.head_ip], ssh_creds=ssh_creds | ||
) | ||
args = dict(name="static-cpu-password", host=[cluster.head_ip], ssh_creds=ssh_creds) | ||
c = rh.cluster(**args).save() | ||
c.restart_server(resync_rh=True) | ||
init_args[id(c)] = args | ||
|
||
test_env().to(c) | ||
|
||
return c | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def static_cpu_pwd_cluster(): | ||
return setup_static_cluster() | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def static_cpu_pwd_cluster_den_launcher(): | ||
return setup_static_cluster(launcher=LauncherType.DEN) | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def static_gpu_pwd_cluster_den_launcher(): | ||
return setup_static_cluster(launcher=LauncherType.DEN, compute_type=computeType.gpu) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters