Skip to content

Commit 9e7851b

Browse files
committed
rename mcad to appwrapper
1 parent a9b314e commit 9e7851b

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,15 +18,15 @@ 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
instascale=False, # Default False
2424
machine_types=["m5.xlarge", "g4dn.xlarge"],
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.

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
@@ -202,7 +202,7 @@ def create_app_wrapper(self):
202202
template=template,
203203
image=image,
204204
instascale=instascale,
205-
mcad=mcad,
205+
appwrapper=appwrapper,
206206
instance_types=instance_types,
207207
env=env,
208208
image_pull_secrets=image_pull_secrets,
@@ -228,7 +228,7 @@ def up(self):
228228
try:
229229
config_check()
230230
api_instance = client.CustomObjectsApi(api_config_handler())
231-
if self.config.mcad:
231+
if self.config.appwrapper:
232232
if self.config.write_to_file:
233233
with open(self.app_wrapper_yaml) as f:
234234
aw = yaml.load(f, Loader=yaml.FullLoader)
@@ -282,7 +282,7 @@ def down(self):
282282
try:
283283
config_check()
284284
api_instance = client.CustomObjectsApi(api_config_handler())
285-
if self.config.mcad:
285+
if self.config.appwrapper:
286286
api_instance.delete_namespaced_custom_object(
287287
group="workload.codeflare.dev",
288288
version="v1beta1",
@@ -304,7 +304,7 @@ def status(
304304
"""
305305
ready = False
306306
status = CodeFlareClusterStatus.UNKNOWN
307-
if self.config.mcad:
307+
if self.config.appwrapper:
308308
# check the app wrapper status
309309
appwrapper = _app_wrapper_status(self.config.name, self.config.namespace)
310310
if appwrapper:
@@ -499,7 +499,7 @@ def job_logs(self, job_id: str) -> str:
499499

500500
def from_k8_cluster_object(
501501
rc,
502-
mcad=True,
502+
appwrapper=True,
503503
write_to_file=False,
504504
verify_tls=True,
505505
):
@@ -536,7 +536,7 @@ def from_k8_cluster_object(
536536
image=rc["spec"]["workerGroupSpecs"][0]["template"]["spec"]["containers"][
537537
0
538538
]["image"],
539-
mcad=mcad,
539+
appwrapper=appwrapper,
540540
write_to_file=write_to_file,
541541
verify_tls=verify_tls,
542542
)
@@ -592,12 +592,14 @@ def list_all_clusters(namespace: str, print_to_console: bool = True):
592592
return clusters
593593

594594

595-
def list_all_queued(namespace: str, print_to_console: bool = True, mcad: bool = False):
595+
def list_all_queued(
596+
namespace: str, print_to_console: bool = True, appwrapper: bool = False
597+
):
596598
"""
597599
Returns (and prints by default) a list of all currently queued-up Ray Clusters
598600
in a given namespace.
599601
"""
600-
if mcad:
602+
if appwrapper:
601603
resources = _get_app_wrappers(
602604
namespace, filter=[AppWrapperStatus.RUNNING, AppWrapperStatus.PENDING]
603605
)
@@ -658,10 +660,10 @@ def get_cluster(
658660

659661
for rc in rcs["items"]:
660662
if rc["metadata"]["name"] == cluster_name:
661-
mcad = _check_aw_exists(cluster_name, namespace)
663+
appwrapper = _check_aw_exists(cluster_name, namespace)
662664
return Cluster.from_k8_cluster_object(
663665
rc,
664-
mcad=mcad,
666+
appwrapper=appwrapper,
665667
write_to_file=write_to_file,
666668
verify_tls=verify_tls,
667669
)

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
@@ -386,7 +386,7 @@ def generate_appwrapper(
386386
template: str,
387387
image: str,
388388
instascale: bool,
389-
mcad: bool,
389+
appwrapper: bool,
390390
instance_types: list,
391391
env,
392392
image_pull_secrets: list,
@@ -443,13 +443,13 @@ def generate_appwrapper(
443443
outfile = os.path.join(directory_path, appwrapper_name + ".yaml")
444444

445445
if write_to_file:
446-
if mcad:
446+
if appwrapper:
447447
write_user_appwrapper(user_yaml, outfile)
448448
else:
449449
write_components(user_yaml, outfile, namespace, local_queue)
450450
return outfile
451451
else:
452-
if mcad:
452+
if appwrapper:
453453
user_yaml = load_appwrapper(user_yaml, name)
454454
else:
455455
user_yaml = load_components(user_yaml, name, namespace, local_queue)

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,7 +323,7 @@ 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
326+
config.appwrapper = False
327327
cluster = Cluster(config)
328328

329329
assert cluster.app_wrapper_yaml == f"{aw_dir}unit-test-cluster-ray.yaml"
@@ -345,7 +345,7 @@ def test_cluster_creation_no_mcad_local_queue(mocker):
345345
)
346346
config = createClusterConfig()
347347
config.name = "unit-test-cluster-ray"
348-
config.mcad = False
348+
config.appwrapper = False
349349
config.write_to_file = True
350350
config.local_queue = "local-queue-default"
351351
cluster = Cluster(config)
@@ -371,7 +371,7 @@ def test_cluster_creation_no_mcad_local_queue(mocker):
371371
image_pull_secrets=["unit-test-pull-secret"],
372372
image="quay.io/project-codeflare/ray:latest-py39-cu118",
373373
write_to_file=True,
374-
mcad=False,
374+
appwrapper=False,
375375
local_queue="local-queue-default",
376376
)
377377
cluster = Cluster(config)
@@ -417,7 +417,7 @@ def test_default_cluster_creation(mocker):
417417
default_config = ClusterConfiguration(
418418
name="unit-test-default-cluster",
419419
image="quay.io/project-codeflare/ray:latest-py39-cu118",
420-
mcad=True,
420+
appwrapper=True,
421421
)
422422
cluster = Cluster(default_config)
423423
test_aw = yaml.load(cluster.app_wrapper_yaml, Loader=yaml.FullLoader)
@@ -558,7 +558,7 @@ def test_cluster_up_down_no_mcad(mocker):
558558
)
559559
config = createClusterConfig()
560560
config.name = "unit-test-cluster-ray"
561-
config.mcad = False
561+
config.appwrapper = False
562562
cluster = Cluster(config)
563563
cluster.up()
564564
cluster.down()
@@ -875,7 +875,7 @@ def test_ray_details(mocker, capsys):
875875
namespace="ns",
876876
image="quay.io/project-codeflare/ray:latest-py39-cu118",
877877
write_to_file=True,
878-
mcad=True,
878+
appwrapper=True,
879879
)
880880
)
881881
captured = capsys.readouterr()
@@ -2612,7 +2612,7 @@ def test_list_queue(mocker, capsys):
26122612
"kubernetes.client.CustomObjectsApi.list_namespaced_custom_object",
26132613
side_effect=get_obj_none,
26142614
)
2615-
list_all_queued("ns", mcad=True)
2615+
list_all_queued("ns", appwrapper=True)
26162616
captured = capsys.readouterr()
26172617
assert captured.out == (
26182618
"╭──────────────────────────────────────────────────────────────────────────────╮\n"
@@ -2623,7 +2623,7 @@ def test_list_queue(mocker, capsys):
26232623
"kubernetes.client.CustomObjectsApi.list_namespaced_custom_object",
26242624
side_effect=get_aw_obj,
26252625
)
2626-
list_all_queued("ns", mcad=True)
2626+
list_all_queued("ns", appwrapper=True)
26272627
captured = capsys.readouterr()
26282628
assert captured.out == (
26292629
"╭──────────────────────────╮\n"
@@ -2710,7 +2710,7 @@ def test_cluster_status(mocker):
27102710
namespace="ns",
27112711
image="quay.io/project-codeflare/ray:latest-py39-cu118",
27122712
write_to_file=True,
2713-
mcad=True,
2713+
appwrapper=True,
27142714
)
27152715
)
27162716
mocker.patch("codeflare_sdk.cluster.cluster._app_wrapper_status", return_value=None)
@@ -2805,7 +2805,7 @@ def test_wait_ready(mocker, capsys):
28052805
namespace="ns",
28062806
image="quay.io/project-codeflare/ray:latest-py39-cu118",
28072807
write_to_file=True,
2808-
mcad=True,
2808+
appwrapper=True,
28092809
)
28102810
)
28112811
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)