Skip to content

Commit db607a2

Browse files
committed
Fix Super-slicing on 1 cube (#1002)
1 parent 284d31f commit db607a2

2 files changed

Lines changed: 26 additions & 18 deletions

File tree

‎src/xpk/core/scheduling.py‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,18 @@ def check_if_workload_can_schedule(
8888
return WorkloadScheduling.UNAVAILABLE
8989
return WorkloadScheduling.AVAILABLE
9090

91+
if cluster_system and _check_super_slicing_availability(
92+
workload_system=workload_system, cluster_system=cluster_system
93+
):
94+
if _check_workload_size_fits(
95+
args,
96+
workload_system,
97+
max_vm_in_cluster=int(resources_config_map[cluster_system.device_type]),
98+
) and _check_super_slicing_topology(workload_system):
99+
return WorkloadScheduling.SUPER_SLICING_AVAILABLE
100+
else:
101+
return WorkloadScheduling.UNAVAILABLE
102+
91103
if workload_system.device_type in resources_config_map:
92104
if _check_workload_size_fits(
93105
args,
@@ -112,18 +124,6 @@ def check_if_workload_can_schedule(
112124
else:
113125
return WorkloadScheduling.UNAVAILABLE
114126

115-
if cluster_system and _check_super_slicing_availability(
116-
workload_system=workload_system, cluster_system=cluster_system
117-
):
118-
if _check_workload_size_fits(
119-
args,
120-
workload_system,
121-
max_vm_in_cluster=int(resources_config_map[cluster_system.device_type]),
122-
) and _check_super_slicing_topology(workload_system):
123-
return WorkloadScheduling.SUPER_SLICING_AVAILABLE
124-
else:
125-
return WorkloadScheduling.UNAVAILABLE
126-
127127
xpk_print(
128128
'Workload scheduling validation failed. XPK will not create the workload'
129129
f' {args.workload}.'

‎src/xpk/core/scheduling_test.py‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -398,15 +398,23 @@ class SchedulingTestCase:
398398
WorkloadScheduling.UNAVAILABLE,
399399
),
400400
(
401-
(
402-
'Super-slicing should be ignored when a given device is already'
403-
' present in the cluster'
401+
'Super-slicing, but one cube',
402+
dataclasses.replace(
403+
SUPER_SLICING_CASE,
404+
workload_system=_get_system_characteristics_or_die('tpu7x-128'),
405+
cluster_system=_get_system_characteristics_or_die('tpu7x-128'),
406+
resources_config_map={'tpu7x-128': '16'},
404407
),
408+
WorkloadScheduling.SUPER_SLICING_AVAILABLE,
409+
),
410+
(
411+
'Super-slicing, but one cube and no super-slicing-topology',
405412
dataclasses.replace(
406413
SUPER_SLICING_CASE,
407-
workload_system=_get_system_characteristics_or_die('tpu7x-64'),
408-
cluster_system=_get_system_characteristics_or_die('tpu7x-64'),
409-
resources_config_map={'tpu7x-64': '16'},
414+
workload_system=_get_system_characteristics_or_die('tpu7x-128'),
415+
cluster_system=_get_system_characteristics_or_die('tpu7x-128'),
416+
resources_config_map={'tpu7x-128': '16'},
417+
super_slicing_topology_set=False,
410418
),
411419
WorkloadScheduling.AVAILABLE,
412420
),

0 commit comments

Comments
 (0)