@@ -29,40 +29,40 @@ def oc_delete(obj_type: str, obj_name: str) -> None:
2929 print (f"Error occurred while deleting { obj_type } /{ obj_name } : { e } " )
3030
3131
32- def is_kueue_managed_job (job_obj ) -> bool :
33- """
34- Returns True if the Job is managed by Kueue.
35- Checks:
36- 1) Job has label 'kueue.x-k8s.io/queue-name'
37- 2) A Workload exists that either:
38- - has an ownerReference pointing to this Job, or
39- - has label job-name=<job-name>
40- """
41- try :
42- md = job_obj .model .metadata
43- labels = getattr (md , "labels" , {}) or {}
44- if "kueue.x-k8s.io/queue-name" in labels :
45- return True
32+ # def is_kueue_managed_job(job_obj) -> bool:
33+ # """
34+ # Returns True if the Job is managed by Kueue.
35+ # Checks:
36+ # 1) Job has label 'kueue.x-k8s.io/queue-name'
37+ # 2) A Workload exists that either:
38+ # - has an ownerReference pointing to this Job, or
39+ # - has label job-name=<job-name>
40+ # """
41+ # try:
42+ # md = job_obj.model.metadata
43+ # labels = getattr(md, "labels", {}) or {}
44+ # if "kueue.x-k8s.io/queue-name" in labels:
45+ # return True
4646
47- job_name = md .name
48- try :
49- workloads = oc .selector ("workloads" ).objects ()
50- except oc .OpenShiftPythonException :
51- workloads = []
47+ # job_name = md.name
48+ # try:
49+ # workloads = oc.selector("workloads").objects()
50+ # except oc.OpenShiftPythonException:
51+ # workloads = []
5252
53- for wl in workloads :
54- wl_md = wl .model .metadata
55- owners = getattr (wl_md , "ownerReferences" , []) or []
56- for o in owners :
57- if (
58- getattr (o , "kind" , "" ) == "Job"
59- and getattr (o , "name" , "" ) == job_name
60- ):
61- return True
62- wl_labels = getattr (wl_md , "labels" , {}) or {}
63- if wl_labels .get ("job-name" ) == job_name :
64- return True
65- except Exception :
66- return False
53+ # for wl in workloads:
54+ # wl_md = wl.model.metadata
55+ # owners = getattr(wl_md, "ownerReferences", []) or []
56+ # for o in owners:
57+ # if (
58+ # getattr(o, "kind", "") == "Job"
59+ # and getattr(o, "name", "") == job_name
60+ # ):
61+ # return True
62+ # wl_labels = getattr(wl_md, "labels", {}) or {}
63+ # if wl_labels.get("job-name") == job_name:
64+ # return True
65+ # except Exception:
66+ # return False
6767
68- return False
68+ # return False
0 commit comments