Skip to content

Commit 8e48e26

Browse files
committed
rename mcad to appwrapper
1 parent 56b4478 commit 8e48e26

File tree

7 files changed

+35
-32
lines changed

7 files changed

+35
-32
lines changed

docs/cluster-configuration.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,18 @@ cluster = Cluster(ClusterConfiguration(
1818
max_cpus=1, # Default 1
1919
min_memory=2, # Default 2
2020
max_memory=2, # Default 2
21-
mcad=True, # Default True
21+
num_gpus=0, # Default 0
22+
appwrapper=True, # Default True
2223
image="quay.io/project-codeflare/ray:latest-py39-cu118", # Mandatory Field
2324
machine_types=["m5.xlarge", "g4dn.xlarge"],
2425
labels={"exampleLabel": "example", "secondLabel": "example"},
2526
))
2627
```
2728

28-
Upon creating a cluster configuration with `mcad=True` an appwrapper will be created featuring the Ray Cluster and any Routes, Ingresses or Secrets that are needed to be created along side it.<br>
29+
Upon creating a cluster configuration with `appwrapper=True` an appwrapper will be created featuring the Ray Cluster and any Routes, Ingresses or Secrets that are needed to be created along side it.<br>
2930
From there a user can call `cluster.up()` and `cluster.down()` to create and remove the appwrapper thus creating and removing the Ray Cluster.
3031

31-
In cases where `mcad=False` a yaml file will be created with the individual Ray Cluster, Route/Ingress and Secret included.<br>
32+
In cases where `appwrapper=False` a yaml file will be created with the individual Ray Cluster, Route/Ingress and Secret included.<br>
3233
The Ray Cluster and service will be created by KubeRay directly and the other components will be individually created.
3334

3435
The `labels={"exampleLabel": "example"}` parameter can be used to apply additional labels to the RayCluster resource.

src/codeflare_sdk/cluster/cluster.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def create_app_wrapper(self):
153153

154154
# Before attempting to create the cluster AW, let's evaluate the ClusterConfig
155155
if self.config.dispatch_priority:
156-
if not self.config.mcad:
156+
if not self.config.appwrapper:
157157
raise ValueError(
158158
"Invalid Cluster Configuration, cannot have dispatch priority without MCAD"
159159
)
@@ -179,7 +179,7 @@ def create_app_wrapper(self):
179179
template = self.config.template
180180
image = self.config.image
181181
instascale = self.config.instascale
182-
mcad = self.config.mcad
182+
appwrapper = self.config.appwrapper
183183
instance_types = self.config.machine_types
184184
env = self.config.envs
185185
image_pull_secrets = self.config.image_pull_secrets
@@ -203,7 +203,7 @@ def create_app_wrapper(self):
203203
template=template,
204204
image=image,
205205
instascale=instascale,
206-
mcad=mcad,
206+
appwrapper=appwrapper,
207207
instance_types=instance_types,
208208
env=env,
209209
image_pull_secrets=image_pull_secrets,
@@ -230,7 +230,7 @@ def up(self):
230230
try:
231231
config_check()
232232
api_instance = client.CustomObjectsApi(api_config_handler())
233-
if self.config.mcad:
233+
if self.config.appwrapper:
234234
if self.config.write_to_file:
235235
with open(self.app_wrapper_yaml) as f:
236236
aw = yaml.load(f, Loader=yaml.FullLoader)
@@ -284,7 +284,7 @@ def down(self):
284284
try:
285285
config_check()
286286
api_instance = client.CustomObjectsApi(api_config_handler())
287-
if self.config.mcad:
287+
if self.config.appwrapper:
288288
api_instance.delete_namespaced_custom_object(
289289
group="workload.codeflare.dev",
290290
version="v1beta1",
@@ -306,7 +306,7 @@ def status(
306306
"""
307307
ready = False
308308
status = CodeFlareClusterStatus.UNKNOWN
309-
if self.config.mcad:
309+
if self.config.appwrapper:
310310
# check the app wrapper status
311311
appwrapper = _app_wrapper_status(self.config.name, self.config.namespace)
312312
if appwrapper:
@@ -501,7 +501,7 @@ def job_logs(self, job_id: str) -> str:
501501

502502
def from_k8_cluster_object(
503503
rc,
504-
mcad=True,
504+
appwrapper=True,
505505
write_to_file=False,
506506
verify_tls=True,
507507
):
@@ -538,7 +538,7 @@ def from_k8_cluster_object(
538538
image=rc["spec"]["workerGroupSpecs"][0]["template"]["spec"]["containers"][
539539
0
540540
]["image"],
541-
mcad=mcad,
541+
appwrapper=appwrapper,
542542
write_to_file=write_to_file,
543543
verify_tls=verify_tls,
544544
local_queue=rc["metadata"]
@@ -597,12 +597,14 @@ def list_all_clusters(namespace: str, print_to_console: bool = True):
597597
return clusters
598598

599599

600-
def list_all_queued(namespace: str, print_to_console: bool = True, mcad: bool = False):
600+
def list_all_queued(
601+
namespace: str, print_to_console: bool = True, appwrapper: bool = False
602+
):
601603
"""
602604
Returns (and prints by default) a list of all currently queued-up Ray Clusters
603605
in a given namespace.
604606
"""
605-
if mcad:
607+
if appwrapper:
606608
resources = _get_app_wrappers(
607609
namespace, filter=[AppWrapperStatus.RUNNING, AppWrapperStatus.PENDING]
608610
)
@@ -675,10 +677,10 @@ def get_cluster(
675677

676678
for rc in rcs["items"]:
677679
if rc["metadata"]["name"] == cluster_name:
678-
mcad = _check_aw_exists(cluster_name, namespace)
680+
appwrapper = _check_aw_exists(cluster_name, namespace)
679681
return Cluster.from_k8_cluster_object(
680682
rc,
681-
mcad=mcad,
683+
appwrapper=appwrapper,
682684
write_to_file=write_to_file,
683685
verify_tls=verify_tls,
684686
)

src/codeflare_sdk/cluster/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class ClusterConfiguration:
4747
num_gpus: int = 0
4848
template: str = f"{dir}/templates/base-template.yaml"
4949
instascale: bool = False
50-
mcad: bool = False
50+
appwrapper: bool = False
5151
envs: dict = field(default_factory=dict)
5252
image: str = ""
5353
image_pull_secrets: list = field(default_factory=list)

src/codeflare_sdk/utils/generate_yaml.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ def generate_appwrapper(
426426
template: str,
427427
image: str,
428428
instascale: bool,
429-
mcad: bool,
429+
appwrapper: bool,
430430
instance_types: list,
431431
env,
432432
image_pull_secrets: list,
@@ -484,13 +484,13 @@ def generate_appwrapper(
484484
outfile = os.path.join(directory_path, appwrapper_name + ".yaml")
485485

486486
if write_to_file:
487-
if mcad:
487+
if appwrapper:
488488
write_user_appwrapper(user_yaml, outfile)
489489
else:
490490
write_components(user_yaml, outfile, namespace, local_queue, labels)
491491
return outfile
492492
else:
493-
if mcad:
493+
if appwrapper:
494494
user_yaml = load_appwrapper(user_yaml, name)
495495
else:
496496
user_yaml = load_components(user_yaml, name, namespace, local_queue, labels)

tests/e2e/start_ray_cluster.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
num_gpus=0,
2323
instascale=False,
2424
image=ray_image,
25-
mcad=True,
25+
appwrapper=True,
2626
)
2727
)
2828

tests/unit_test.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def test_config_creation():
269269
assert config.machine_types == ["cpu.small", "gpu.large"]
270270
assert config.image_pull_secrets == ["unit-test-pull-secret"]
271271
assert config.dispatch_priority == None
272-
assert config.mcad == True
272+
assert config.appwrapper == True
273273

274274

275275
def test_cluster_creation(mocker):
@@ -345,8 +345,8 @@ def test_cluster_creation_no_mcad(mocker):
345345
config = createClusterConfig()
346346
config.name = "unit-test-cluster-ray"
347347
config.write_to_file = True
348-
config.mcad = False
349348
config.labels = {"testlabel": "test", "testlabel2": "test"}
349+
config.appwrapper = False
350350
cluster = Cluster(config)
351351

352352
assert cluster.app_wrapper_yaml == f"{aw_dir}unit-test-cluster-ray.yaml"
@@ -372,7 +372,7 @@ def test_cluster_creation_no_mcad_local_queue(mocker):
372372
)
373373
config = createClusterConfig()
374374
config.name = "unit-test-cluster-ray"
375-
config.mcad = False
375+
config.appwrapper = False
376376
config.write_to_file = True
377377
config.local_queue = "local-queue-default"
378378
config.labels = {"testlabel": "test", "testlabel2": "test"}
@@ -399,7 +399,7 @@ def test_cluster_creation_no_mcad_local_queue(mocker):
399399
image_pull_secrets=["unit-test-pull-secret"],
400400
image="quay.io/project-codeflare/ray:latest-py39-cu118",
401401
write_to_file=True,
402-
mcad=False,
402+
appwrapper=False,
403403
local_queue="local-queue-default",
404404
labels={"testlabel": "test", "testlabel2": "test"},
405405
)
@@ -446,7 +446,7 @@ def test_default_cluster_creation(mocker):
446446
default_config = ClusterConfiguration(
447447
name="unit-test-default-cluster",
448448
image="quay.io/project-codeflare/ray:latest-py39-cu118",
449-
mcad=True,
449+
appwrapper=True,
450450
)
451451
cluster = Cluster(default_config)
452452
test_aw = yaml.load(cluster.app_wrapper_yaml, Loader=yaml.FullLoader)
@@ -587,7 +587,7 @@ def test_cluster_up_down_no_mcad(mocker):
587587
)
588588
config = createClusterConfig()
589589
config.name = "unit-test-cluster-ray"
590-
config.mcad = False
590+
config.appwrapper = False
591591
cluster = Cluster(config)
592592
cluster.up()
593593
cluster.down()
@@ -904,7 +904,7 @@ def test_ray_details(mocker, capsys):
904904
namespace="ns",
905905
image="quay.io/project-codeflare/ray:latest-py39-cu118",
906906
write_to_file=True,
907-
mcad=True,
907+
appwrapper=True,
908908
)
909909
)
910910
captured = capsys.readouterr()
@@ -2672,7 +2672,7 @@ def test_list_queue(mocker, capsys):
26722672
"kubernetes.client.CustomObjectsApi.list_namespaced_custom_object",
26732673
side_effect=get_obj_none,
26742674
)
2675-
list_all_queued("ns", mcad=True)
2675+
list_all_queued("ns", appwrapper=True)
26762676
captured = capsys.readouterr()
26772677
assert captured.out == (
26782678
"╭──────────────────────────────────────────────────────────────────────────────╮\n"
@@ -2683,7 +2683,7 @@ def test_list_queue(mocker, capsys):
26832683
"kubernetes.client.CustomObjectsApi.list_namespaced_custom_object",
26842684
side_effect=get_aw_obj,
26852685
)
2686-
list_all_queued("ns", mcad=True)
2686+
list_all_queued("ns", appwrapper=True)
26872687
captured = capsys.readouterr()
26882688
assert captured.out == (
26892689
"╭──────────────────────────╮\n"
@@ -2770,7 +2770,7 @@ def test_cluster_status(mocker):
27702770
namespace="ns",
27712771
image="quay.io/project-codeflare/ray:latest-py39-cu118",
27722772
write_to_file=True,
2773-
mcad=True,
2773+
appwrapper=True,
27742774
)
27752775
)
27762776
mocker.patch("codeflare_sdk.cluster.cluster._app_wrapper_status", return_value=None)
@@ -2865,7 +2865,7 @@ def test_wait_ready(mocker, capsys):
28652865
namespace="ns",
28662866
image="quay.io/project-codeflare/ray:latest-py39-cu118",
28672867
write_to_file=True,
2868-
mcad=True,
2868+
appwrapper=True,
28692869
)
28702870
)
28712871
try:

tests/unit_test_support.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def createClusterConfig():
1414
min_memory=5,
1515
max_memory=6,
1616
num_gpus=7,
17-
mcad=True,
17+
appwrapper=True,
1818
instascale=True,
1919
machine_types=["cpu.small", "gpu.large"],
2020
image_pull_secrets=["unit-test-pull-secret"],

0 commit comments

Comments
 (0)