Skip to content

Commit

Permalink
nomad: refactor filter running allocs (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
resmo authored Jun 26, 2023
1 parent 2464ba2 commit c434854
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions chaotic/cloud/nomad.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit c434854

Please sign in to comment.