Skip to content

Commit 43647f4

Browse files
committed
remove instascale
1 parent e215436 commit 43647f4

File tree

9 files changed

+7
-78
lines changed

9 files changed

+7
-78
lines changed

docs/cluster-configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ cluster = Cluster(ClusterConfiguration(
1818
min_memory=2, # Default 2
1919
max_memory=2, # Default 2
2020
num_gpus=0, # Default 0
21-
appwrapper=True, # Default True
21+
appwrapper=True, # Default False
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"},

src/codeflare_sdk/cluster/cluster.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ def create_app_wrapper(self):
146146
workers = self.config.num_workers
147147
template = self.config.template
148148
image = self.config.image
149-
instascale = self.config.instascale
150149
appwrapper = self.config.appwrapper
151150
instance_types = self.config.machine_types
152151
env = self.config.envs
@@ -169,7 +168,6 @@ def create_app_wrapper(self):
169168
workers=workers,
170169
template=template,
171170
image=image,
172-
instascale=instascale,
173171
appwrapper=appwrapper,
174172
instance_types=instance_types,
175173
env=env,
@@ -499,7 +497,6 @@ def from_k8_cluster_object(
499497
"resources"
500498
]["limits"]["nvidia.com/gpu"]
501499
),
502-
instascale=True if machine_types else False,
503500
image=rc["spec"]["workerGroupSpecs"][0]["template"]["spec"]["containers"][
504501
0
505502
]["image"],

src/codeflare_sdk/cluster/config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ class ClusterConfiguration:
4646
max_memory: typing.Union[int, str] = 2
4747
num_gpus: int = 0
4848
template: str = f"{dir}/templates/base-template.yaml"
49-
instascale: bool = False
5049
appwrapper: bool = False
5150
envs: dict = field(default_factory=dict)
5251
image: str = ""

src/codeflare_sdk/utils/generate_yaml.py

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,9 @@ def update_names(yaml, item, appwrapper_name, cluster_name, namespace):
8787
lower_meta["namespace"] = namespace
8888

8989

90-
def update_labels(yaml, instascale, instance_types):
90+
def update_labels(yaml, instance_types):
9191
metadata = yaml.get("metadata")
92-
if instascale:
93-
if not len(instance_types) > 0:
94-
sys.exit(
95-
"If instascale is set to true, must provide at least one instance type"
96-
)
97-
type_str = ""
98-
for type in instance_types:
99-
type_str += type + "_"
100-
type_str = type_str[:-1]
101-
metadata["labels"]["orderedinstance"] = type_str
102-
else:
103-
metadata.pop("labels")
92+
metadata.pop("labels")
10493

10594

10695
def update_priority(yaml, item):
@@ -158,18 +147,8 @@ def update_custompodresources(
158147
sys.exit("Error: malformed template")
159148

160149

161-
def update_affinity(spec, appwrapper_name, instascale):
162-
if instascale:
163-
node_selector_terms = (
164-
spec.get("affinity")
165-
.get("nodeAffinity")
166-
.get("requiredDuringSchedulingIgnoredDuringExecution")
167-
.get("nodeSelectorTerms")
168-
)
169-
node_selector_terms[0]["matchExpressions"][0]["values"][0] = appwrapper_name
170-
node_selector_terms[0]["matchExpressions"][0]["key"] = appwrapper_name
171-
else:
172-
spec.pop("affinity")
150+
def update_affinity(spec, appwrapper_name):
151+
spec.pop("affinity")
173152

174153

175154
def update_image(spec, image):
@@ -220,7 +199,6 @@ def update_nodes(
220199
gpu,
221200
workers,
222201
image,
223-
instascale,
224202
env,
225203
image_pull_secrets,
226204
head_cpus,
@@ -241,7 +219,7 @@ def update_nodes(
241219

242220
for comp in [head, worker]:
243221
spec = comp.get("template").get("spec")
244-
update_affinity(spec, appwrapper_name, instascale)
222+
update_affinity(spec, appwrapper_name)
245223
update_image_pull_secrets(spec, image_pull_secrets)
246224
update_image(spec, image)
247225
update_env(spec, env)
@@ -385,7 +363,6 @@ def generate_appwrapper(
385363
workers: int,
386364
template: str,
387365
image: str,
388-
instascale: bool,
389366
appwrapper: bool,
390367
instance_types: list,
391368
env,
@@ -406,7 +383,7 @@ def generate_appwrapper(
406383
cluster_name,
407384
namespace,
408385
)
409-
update_labels(user_yaml, instascale, instance_types)
386+
update_labels(user_yaml, instance_types)
410387
update_priority(user_yaml, item)
411388
update_custompodresources(
412389
item,
@@ -430,7 +407,6 @@ def generate_appwrapper(
430407
gpu,
431408
workers,
432409
image,
433-
instascale,
434410
env,
435411
image_pull_secrets,
436412
head_cpus,

tests/e2e/start_ray_cluster.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
min_memory=1,
2121
max_memory=2,
2222
num_gpus=0,
23-
instascale=False,
2423
image=ray_image,
2524
appwrapper=True,
2625
)

tests/test-case-no-mcad.yamls

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,6 @@ spec:
3131
serviceType: ClusterIP
3232
template:
3333
spec:
34-
affinity:
35-
nodeAffinity:
36-
requiredDuringSchedulingIgnoredDuringExecution:
37-
nodeSelectorTerms:
38-
- matchExpressions:
39-
- key: unit-test-cluster-ray
40-
operator: In
41-
values:
42-
- unit-test-cluster-ray
4334
containers:
4435
- image: quay.io/project-codeflare/ray:latest-py39-cu118
4536
imagePullPolicy: Always
@@ -113,15 +104,6 @@ spec:
113104
labels:
114105
key: value
115106
spec:
116-
affinity:
117-
nodeAffinity:
118-
requiredDuringSchedulingIgnoredDuringExecution:
119-
nodeSelectorTerms:
120-
- matchExpressions:
121-
- key: unit-test-cluster-ray
122-
operator: In
123-
values:
124-
- unit-test-cluster-ray
125107
containers:
126108
- image: quay.io/project-codeflare/ray:latest-py39-cu118
127109
lifecycle:

tests/test-case.yaml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
apiVersion: workload.codeflare.dev/v1beta1
22
kind: AppWrapper
33
metadata:
4-
labels:
5-
orderedinstance: cpu.small_gpu.large
64
name: unit-test-cluster
75
namespace: ns
86
spec:
@@ -58,15 +56,6 @@ spec:
5856
serviceType: ClusterIP
5957
template:
6058
spec:
61-
affinity:
62-
nodeAffinity:
63-
requiredDuringSchedulingIgnoredDuringExecution:
64-
nodeSelectorTerms:
65-
- matchExpressions:
66-
- key: unit-test-cluster
67-
operator: In
68-
values:
69-
- unit-test-cluster
7059
containers:
7160
- image: quay.io/project-codeflare/ray:latest-py39-cu118
7261
imagePullPolicy: Always
@@ -140,15 +129,6 @@ spec:
140129
labels:
141130
key: value
142131
spec:
143-
affinity:
144-
nodeAffinity:
145-
requiredDuringSchedulingIgnoredDuringExecution:
146-
nodeSelectorTerms:
147-
- matchExpressions:
148-
- key: unit-test-cluster
149-
operator: In
150-
values:
151-
- unit-test-cluster
152132
containers:
153133
- image: quay.io/project-codeflare/ray:latest-py39-cu118
154134
lifecycle:

tests/unit_test.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ def test_config_creation():
252252
assert config.num_gpus == 7
253253
assert config.image == "quay.io/project-codeflare/ray:latest-py39-cu118"
254254
assert config.template == f"{parent}/src/codeflare_sdk/templates/base-template.yaml"
255-
assert config.instascale
256255
assert config.machine_types == ["cpu.small", "gpu.large"]
257256
assert config.image_pull_secrets == ["unit-test-pull-secret"]
258257
assert config.appwrapper == True
@@ -367,7 +366,6 @@ def test_cluster_creation_no_mcad_local_queue(mocker):
367366
min_memory=5,
368367
max_memory=6,
369368
num_gpus=7,
370-
instascale=True,
371369
machine_types=["cpu.small", "gpu.large"],
372370
image_pull_secrets=["unit-test-pull-secret"],
373371
image="quay.io/project-codeflare/ray:latest-py39-cu118",
@@ -2451,7 +2449,6 @@ def test_get_cluster(mocker):
24512449
assert cluster_config.min_cpus == 1 and cluster_config.max_cpus == 1
24522450
assert cluster_config.min_memory == "2G" and cluster_config.max_memory == "2G"
24532451
assert cluster_config.num_gpus == 0
2454-
assert cluster_config.instascale
24552452
assert (
24562453
cluster_config.image
24572454
== "ghcr.io/foundation-model-stack/base:ray2.1.0-py38-gpu-pytorch1.12.0cu116-20221213-193103"

tests/unit_test_support.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ def createClusterConfig():
1515
max_memory=6,
1616
num_gpus=7,
1717
appwrapper=True,
18-
instascale=True,
1918
machine_types=["cpu.small", "gpu.large"],
2019
image_pull_secrets=["unit-test-pull-secret"],
2120
image="quay.io/project-codeflare/ray:latest-py39-cu118",

0 commit comments

Comments
 (0)