Skip to content

Commit 832f82e

Browse files
committed
Add cpu and memory to covered resources
1 parent 24c2cba commit 832f82e

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

src/xpk/core/kueue.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
run_command_with_updates,
2929
run_command_with_updates_retry,
3030
)
31-
from .pathways import add_pw_resource_flavors, add_pw_resources_to_kueue
31+
from .pathways import add_pw_resource_flavors
3232
from .resources import AutoprovisioningConfig
3333
from .scheduling import (
3434
create_accelerator_label,
@@ -104,7 +104,6 @@
104104
namespaceSelector: {{}} # match all.
105105
resourceGroups:
106106
{covered_resources_config}
107-
{pw_resources_kueue}
108107
{admission_checks}
109108
---
110109
apiVersion: kueue.x-k8s.io/v1beta1
@@ -439,6 +438,7 @@ def install_kueue_crs(
439438
cluster_hardware_name=cluster_hardware_name,
440439
resource_type=resource_type,
441440
total_chips=total_chips,
441+
args=args,
442442
)
443443
topology_label = ''
444444
if system.device_type in [
@@ -463,7 +463,6 @@ def install_kueue_crs(
463463
covered_resources_config=covered_resources_config,
464464
resource_type=res_type,
465465
pw_resource_flavors=add_pw_resource_flavors(args),
466-
pw_resources_kueue=add_pw_resources_to_kueue(args),
467466
admission_checks=admission_checks,
468467
managed_resource=res_type,
469468
cluster_queue_name=CLUSTER_QUEUE_NAME,
@@ -487,7 +486,7 @@ def install_kueue_crs(
487486

488487

489488
def get_kueue_covered_resources_config(
490-
cluster_hardware_name, resource_type, total_chips
489+
cluster_hardware_name, resource_type, total_chips, args
491490
) -> str:
492491
"""Gets Kueue covered resources configuration.
493492
@@ -501,6 +500,16 @@ def get_kueue_covered_resources_config(
501500
"""
502501
config_format = """
503502
- coveredResources: ["{resource_type}"]
503+
flavors:
504+
- name: {cluster_hardware_name}
505+
resources:
506+
- name: "{resource_type}"
507+
nominalQuota: {total_chips}
508+
"""
509+
510+
if args.enable_pathways:
511+
config_format = """
512+
- coveredResources: ["{resource_type}", "cpu", "memory"]
504513
flavors:
505514
- name: {cluster_hardware_name}
506515
resources:
@@ -510,6 +519,14 @@ def get_kueue_covered_resources_config(
510519
nominalQuota: 99999999999
511520
- name: "memory"
512521
nominalQuota: 9999999Ti
522+
- name: cpu-user
523+
resources:
524+
- name: "{resource_type}"
525+
nominalQuota: 0
526+
- name: "cpu"
527+
nominalQuota: 480
528+
- name: "memory"
529+
nominalQuota: 2000G
513530
"""
514531
config_string = config_format.format(
515532
cluster_hardware_name=cluster_hardware_name,

src/xpk/core/pathways.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,6 @@ def add_pw_resource_flavors(args):
3737
return ''
3838

3939

40-
def add_pw_resources_to_kueue(args):
41-
"""Add resource flavors required for Pathways, to the cluster queue."""
42-
resources_yaml = """- coveredResources: ["cpu", "memory"]
43-
flavors:
44-
- name: cpu-user
45-
resources:
46-
- name: "cpu"
47-
nominalQuota: 480
48-
- name: "memory"
49-
nominalQuota: 2000G"""
50-
if args.enable_pathways:
51-
return resources_yaml
52-
return ''
53-
54-
5540
def ensure_pathways_workload_prerequisites(args, system) -> bool:
5641
"""Check all Pathways workload prerequisites and set necessary args.
5742

0 commit comments

Comments
 (0)