Skip to content

Commit e3dfd77

Browse files
committed
remove instascale
1 parent 547ddd7 commit e3dfd77

File tree

9 files changed

+7
-79
lines changed

9 files changed

+7
-79
lines changed

docs/cluster-configuration.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ 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
23-
instascale=False, # Default False
2423
machine_types=["m5.xlarge", "g4dn.xlarge"],
2524
))
2625
```

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
@@ -168,7 +167,6 @@ def create_app_wrapper(self):
168167
workers=workers,
169168
template=template,
170169
image=image,
171-
instascale=instascale,
172170
appwrapper=appwrapper,
173171
instance_types=instance_types,
174172
env=env,
@@ -497,7 +495,6 @@ def from_k8_cluster_object(
497495
"resources"
498496
]["limits"]["nvidia.com/gpu"]
499497
),
500-
instascale=True if machine_types else False,
501498
image=rc["spec"]["workerGroupSpecs"][0]["template"]["spec"]["containers"][
502499
0
503500
]["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)
@@ -373,7 +351,6 @@ def generate_appwrapper(
373351
workers: int,
374352
template: str,
375353
image: str,
376-
instascale: bool,
377354
appwrapper: bool,
378355
instance_types: list,
379356
env,
@@ -393,7 +370,7 @@ def generate_appwrapper(
393370
cluster_name,
394371
namespace,
395372
)
396-
update_labels(user_yaml, instascale, instance_types)
373+
update_labels(user_yaml, instance_types)
397374
update_priority(user_yaml, item)
398375
update_custompodresources(
399376
item,
@@ -417,7 +394,6 @@ def generate_appwrapper(
417394
gpu,
418395
workers,
419396
image,
420-
instascale,
421397
env,
422398
image_pull_secrets,
423399
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
@@ -29,15 +29,6 @@ spec:
2929
serviceType: ClusterIP
3030
template:
3131
spec:
32-
affinity:
33-
nodeAffinity:
34-
requiredDuringSchedulingIgnoredDuringExecution:
35-
nodeSelectorTerms:
36-
- matchExpressions:
37-
- key: unit-test-cluster-ray
38-
operator: In
39-
values:
40-
- unit-test-cluster-ray
4132
containers:
4233
- image: quay.io/project-codeflare/ray:latest-py39-cu118
4334
imagePullPolicy: Always
@@ -111,15 +102,6 @@ spec:
111102
labels:
112103
key: value
113104
spec:
114-
affinity:
115-
nodeAffinity:
116-
requiredDuringSchedulingIgnoredDuringExecution:
117-
nodeSelectorTerms:
118-
- matchExpressions:
119-
- key: unit-test-cluster-ray
120-
operator: In
121-
values:
122-
- unit-test-cluster-ray
123105
containers:
124106
- image: quay.io/project-codeflare/ray:latest-py39-cu118
125107
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
@@ -365,7 +364,6 @@ def test_cluster_creation_no_mcad_local_queue(mocker):
365364
min_memory=5,
366365
max_memory=6,
367366
num_gpus=7,
368-
instascale=True,
369367
machine_types=["cpu.small", "gpu.large"],
370368
image_pull_secrets=["unit-test-pull-secret"],
371369
image="quay.io/project-codeflare/ray:latest-py39-cu118",
@@ -2447,7 +2445,6 @@ def test_get_cluster(mocker):
24472445
assert cluster_config.min_cpus == 1 and cluster_config.max_cpus == 1
24482446
assert cluster_config.min_memory == "2G" and cluster_config.max_memory == "2G"
24492447
assert cluster_config.num_gpus == 0
2450-
assert cluster_config.instascale
24512448
assert (
24522449
cluster_config.image
24532450
== "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)