From 3733159f8362bccb4ada23630b37c5ad8818df2a Mon Sep 17 00:00:00 2001 From: Ignacio Heredia Date: Mon, 22 Apr 2024 12:09:38 +0200 Subject: [PATCH] fix: only retrieve GPU models from _eligible_ nodes --- ai4papi/nomad/common.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ai4papi/nomad/common.py b/ai4papi/nomad/common.py index 85b5845..4c1ed64 100644 --- a/ai4papi/nomad/common.py +++ b/ai4papi/nomad/common.py @@ -364,8 +364,14 @@ def get_gpu_models(): gpu_models = set() nodes = Nomad.nodes.get_nodes(resources=True) for node in nodes: + # Discard GPU models of nodes that are not eligible + if node['SchedulingEligibility'] != 'eligible': + continue + + # Retrieve GPU models of the node devices = node['NodeResources']['Devices'] gpus = [d for d in devices if d['Type'] == 'gpu'] if devices else [] for gpu in gpus: gpu_models.add(gpu['Name']) + return list(gpu_models)