From b42643a10536a8b313ae32cc3cb8664b87ea370f Mon Sep 17 00:00:00 2001 From: Omkar Pangarkar Date: Wed, 23 Mar 2022 12:52:16 +0530 Subject: [PATCH 1/2] disable immediate allocation for NP jobs --- sched/adaptdl_sched/allocator.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sched/adaptdl_sched/allocator.py b/sched/adaptdl_sched/allocator.py index 3f30fbf5..821b4792 100644 --- a/sched/adaptdl_sched/allocator.py +++ b/sched/adaptdl_sched/allocator.py @@ -59,7 +59,10 @@ async def _allocate_one_loop(self): async for event in watch.stream( self._objs_api.list_namespaced_custom_object, *self._custom_resource, timeout_seconds=60): - if event["type"] == "ADDED": # there is a n arriving job + # We only consider newly-added preemptible jobs + # because this allocation may not be final. + if (event["type"] == "ADDED" and + event["object"]["spec"]["preemptible"]): async with self._lock: await self._allocate_one(event) From 893e1053d918e8fa8b4f18576070ef48e1aff50a Mon Sep 17 00:00:00 2001 From: Omkar Pangarkar Date: Wed, 23 Mar 2022 13:09:17 +0530 Subject: [PATCH 2/2] fix indent --- sched/adaptdl_sched/allocator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sched/adaptdl_sched/allocator.py b/sched/adaptdl_sched/allocator.py index 821b4792..4c803693 100644 --- a/sched/adaptdl_sched/allocator.py +++ b/sched/adaptdl_sched/allocator.py @@ -62,7 +62,7 @@ async def _allocate_one_loop(self): # We only consider newly-added preemptible jobs # because this allocation may not be final. if (event["type"] == "ADDED" and - event["object"]["spec"]["preemptible"]): + event["object"]["spec"]["preemptible"]): async with self._lock: await self._allocate_one(event)