Skip to content

Commit 1eba343

Browse files
committed
rename mcad to appwrapper
1 parent 9b49b59 commit 1eba343

File tree

7 files changed

+34
-32
lines changed

7 files changed

+34
-32
lines changed

docs/cluster-configuration.md

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

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>
28+
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>
2929
From there a user can call `cluster.up()` and `cluster.down()` to create and remove the appwrapper thus creating and removing the Ray Cluster.
3030

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

3434
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
)
@@ -594,12 +594,14 @@ def list_all_clusters(namespace: str, print_to_console: bool = True):
594594
return clusters
595595

596596

597-
def list_all_queued(namespace: str, print_to_console: bool = True, mcad: bool = False):
597+
def list_all_queued(
598+
namespace: str, print_to_console: bool = True, appwrapper: bool = False
599+
):
598600
"""
599601
Returns (and prints by default) a list of all currently queued-up Ray Clusters
600602
in a given namespace.
601603
"""
602-
if mcad:
604+
if appwrapper:
603605
resources = _get_app_wrappers(
604606
namespace, filter=[AppWrapperStatus.RUNNING, AppWrapperStatus.PENDING]
605607
)
@@ -660,10 +662,10 @@ def get_cluster(
660662

661663
for rc in rcs["items"]:
662664
if rc["metadata"]["name"] == cluster_name:
663-
mcad = _check_aw_exists(cluster_name, namespace)
665+
appwrapper = _check_aw_exists(cluster_name, namespace)
664666
return Cluster.from_k8_cluster_object(
665667
rc,
666-
mcad=mcad,
668+
appwrapper=appwrapper,
667669
write_to_file=write_to_file,
668670
verify_tls=verify_tls,
669671
)

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
@@ -398,7 +398,7 @@ def generate_appwrapper(
398398
template: str,
399399
image: str,
400400
instascale: bool,
401-
mcad: bool,
401+
appwrapper: bool,
402402
instance_types: list,
403403
env,
404404
image_pull_secrets: list,
@@ -456,13 +456,13 @@ def generate_appwrapper(
456456
outfile = os.path.join(directory_path, appwrapper_name + ".yaml")
457457

458458
if write_to_file:
459-
if mcad:
459+
if appwrapper:
460460
write_user_appwrapper(user_yaml, outfile)
461461
else:
462462
write_components(user_yaml, outfile, namespace, local_queue, labels)
463463
return outfile
464464
else:
465-
if mcad:
465+
if appwrapper:
466466
user_yaml = load_appwrapper(user_yaml, name)
467467
else:
468468
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
@@ -256,7 +256,7 @@ def test_config_creation():
256256
assert config.machine_types == ["cpu.small", "gpu.large"]
257257
assert config.image_pull_secrets == ["unit-test-pull-secret"]
258258
assert config.dispatch_priority == None
259-
assert config.mcad == True
259+
assert config.appwrapper == True
260260

261261

262262
def test_cluster_creation(mocker):
@@ -323,8 +323,8 @@ def test_cluster_creation_no_mcad(mocker):
323323
config = createClusterConfig()
324324
config.name = "unit-test-cluster-ray"
325325
config.write_to_file = True
326-
config.mcad = False
327326
config.labels = {"testlabel": "test", "testlabel2": "test"}
327+
config.appwrapper = False
328328
cluster = Cluster(config)
329329

330330
assert cluster.app_wrapper_yaml == f"{aw_dir}unit-test-cluster-ray.yaml"
@@ -346,7 +346,7 @@ def test_cluster_creation_no_mcad_local_queue(mocker):
346346
)
347347
config = createClusterConfig()
348348
config.name = "unit-test-cluster-ray"
349-
config.mcad = False
349+
config.appwrapper = False
350350
config.write_to_file = True
351351
config.local_queue = "local-queue-default"
352352
config.labels = {"testlabel": "test", "testlabel2": "test"}
@@ -373,7 +373,7 @@ def test_cluster_creation_no_mcad_local_queue(mocker):
373373
image_pull_secrets=["unit-test-pull-secret"],
374374
image="quay.io/project-codeflare/ray:latest-py39-cu118",
375375
write_to_file=True,
376-
mcad=False,
376+
appwrapper=False,
377377
local_queue="local-queue-default",
378378
labels={"testlabel": "test", "testlabel2": "test"},
379379
)
@@ -420,7 +420,7 @@ def test_default_cluster_creation(mocker):
420420
default_config = ClusterConfiguration(
421421
name="unit-test-default-cluster",
422422
image="quay.io/project-codeflare/ray:latest-py39-cu118",
423-
mcad=True,
423+
appwrapper=True,
424424
)
425425
cluster = Cluster(default_config)
426426
test_aw = yaml.load(cluster.app_wrapper_yaml, Loader=yaml.FullLoader)
@@ -561,7 +561,7 @@ def test_cluster_up_down_no_mcad(mocker):
561561
)
562562
config = createClusterConfig()
563563
config.name = "unit-test-cluster-ray"
564-
config.mcad = False
564+
config.appwrapper = False
565565
cluster = Cluster(config)
566566
cluster.up()
567567
cluster.down()
@@ -878,7 +878,7 @@ def test_ray_details(mocker, capsys):
878878
namespace="ns",
879879
image="quay.io/project-codeflare/ray:latest-py39-cu118",
880880
write_to_file=True,
881-
mcad=True,
881+
appwrapper=True,
882882
)
883883
)
884884
captured = capsys.readouterr()
@@ -2615,7 +2615,7 @@ def test_list_queue(mocker, capsys):
26152615
"kubernetes.client.CustomObjectsApi.list_namespaced_custom_object",
26162616
side_effect=get_obj_none,
26172617
)
2618-
list_all_queued("ns", mcad=True)
2618+
list_all_queued("ns", appwrapper=True)
26192619
captured = capsys.readouterr()
26202620
assert captured.out == (
26212621
"╭──────────────────────────────────────────────────────────────────────────────╮\n"
@@ -2626,7 +2626,7 @@ def test_list_queue(mocker, capsys):
26262626
"kubernetes.client.CustomObjectsApi.list_namespaced_custom_object",
26272627
side_effect=get_aw_obj,
26282628
)
2629-
list_all_queued("ns", mcad=True)
2629+
list_all_queued("ns", appwrapper=True)
26302630
captured = capsys.readouterr()
26312631
assert captured.out == (
26322632
"╭──────────────────────────╮\n"
@@ -2713,7 +2713,7 @@ def test_cluster_status(mocker):
27132713
namespace="ns",
27142714
image="quay.io/project-codeflare/ray:latest-py39-cu118",
27152715
write_to_file=True,
2716-
mcad=True,
2716+
appwrapper=True,
27172717
)
27182718
)
27192719
mocker.patch("codeflare_sdk.cluster.cluster._app_wrapper_status", return_value=None)
@@ -2808,7 +2808,7 @@ def test_wait_ready(mocker, capsys):
28082808
namespace="ns",
28092809
image="quay.io/project-codeflare/ray:latest-py39-cu118",
28102810
write_to_file=True,
2811-
mcad=True,
2811+
appwrapper=True,
28122812
)
28132813
)
28142814
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)