From c4348540552e7a5528cdaf7f427ef813e635de01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Moser?= Date: Mon, 26 Jun 2023 11:05:44 +0200 Subject: [PATCH] nomad: refactor filter running allocs (#40) --- chaotic/cloud/nomad.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/chaotic/cloud/nomad.py b/chaotic/cloud/nomad.py index 0e4ab16..e768d14 100644 --- a/chaotic/cloud/nomad.py +++ b/chaotic/cloud/nomad.py @@ -63,8 +63,7 @@ def list_allocs(self, namespace: Optional[str] = None) -> List[dict]: "namespace": namespace, } r = self.query_api("get", "allocations", params=params) - allocs = [alloc for alloc in r.json() if alloc["ClientStatus"] == "running"] - return allocs + return r.json() def read_alloc(self, alloc_id: str) -> dict: r = self.query_api("get", f"allocation/{alloc_id}") @@ -135,7 +134,7 @@ def action(self) -> None: def action_job(self) -> None: namespace = self.get_namespace() if namespace: - allocs = self.nomad.list_allocs(namespace=namespace) + allocs = [alloc for alloc in self.nomad.list_allocs(namespace=namespace) if alloc["ClientStatus"] == "running"] job_type_skiplist = self.configs.get("job_type_skiplist") if job_type_skiplist: