Skip to content

Commit 9121e6a

Browse files
authored
fix(sdk): always add queue label regardless of queue existence (#3221)
Fixes #2775 Signed-off-by: Pavan More <pavansmore05@gmail.com>
1 parent 9e12c68 commit 9121e6a

2 files changed

Lines changed: 21 additions & 7 deletions

File tree

sdk/python/kubeflow/training/api/training_client.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -598,12 +598,11 @@ def create_job(
598598
)
599599

600600
# Handle Kueue queue validation and labeling
601-
if queue_name is not None:
602-
queue_exists = self._check_queue_exists(queue_name, namespace)
603-
if queue_exists is not False:
604-
if job.metadata.labels is None:
605-
job.metadata.labels = {}
606-
job.metadata.labels[constants.LOCAL_QUEUE_LABEL] = queue_name
601+
if queue_name and queue_name.strip():
602+
self._check_queue_exists(queue_name, namespace)
603+
if job.metadata.labels is None:
604+
job.metadata.labels = {}
605+
job.metadata.labels[constants.LOCAL_QUEUE_LABEL] = queue_name
607606

608607
# Create the Training Job.
609608
try:

sdk/python/kubeflow/training/api/training_client_test.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,21 @@ def __init__(self):
697697
labels=None,
698698
),
699699
),
700+
(
701+
"valid flow with empty queue name",
702+
{
703+
"name": TEST_NAME,
704+
"namespace": TEST_NAME,
705+
"base_image": TEST_IMAGE,
706+
"num_workers": 1,
707+
"queue_name": "",
708+
},
709+
SUCCESS,
710+
create_job(
711+
num_workers=1,
712+
labels=None,
713+
),
714+
),
700715
(
701716
"valid flow with non-existent queue",
702717
{
@@ -709,7 +724,7 @@ def __init__(self):
709724
SUCCESS,
710725
create_job(
711726
num_workers=1,
712-
labels=None,
727+
labels={constants.LOCAL_QUEUE_LABEL: "non-existent-queue"},
713728
),
714729
),
715730
(

0 commit comments

Comments
 (0)