From 9071eb15937c71131404b2d0aa5edfc0c2b75236 Mon Sep 17 00:00:00 2001 From: Franck Dary <franck.dary@lis-lab.fr> Date: Sat, 18 Apr 2020 13:45:58 +0200 Subject: [PATCH] launchBatches now detects nodes that are not alive --- UD_any/launchBatches.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/UD_any/launchBatches.py b/UD_any/launchBatches.py index cae8bcd..2e0b3df 100755 --- a/UD_any/launchBatches.py +++ b/UD_any/launchBatches.py @@ -52,7 +52,7 @@ def launchTrainOar(mode, expName, arguments, nbHours) : command += " -l walltime=%d:00:00"%nbHours command += " \'" + "./train.sh %s bin/%s %s --silent"%(mode,expName,arguments) + "\'" - os.system(command) + subprocess.Popen(command, shell=True).wait() ############################################################################### ############################################################################### @@ -85,7 +85,7 @@ def launchEvalOar(mode, expName, nbHours) : command += " -l walltime=%d:00:00"%nbHours command += " \"" + "./evaluate.sh %s bin/%s --silent"%(mode,expName) + "\"" - os.system(command) + subprocess.Popen(command, shell=True).wait() ############################################################################### ############################################################################### @@ -123,14 +123,23 @@ def getOarNbUsedGpuPerNode() : return res ############################################################################### +############################################################################### +def getOarNotAliveNodes() : + return subprocess.Popen("oarnodes | grep -B 2 'state : [^A]' | grep 'network_address' | sort --unique | awk '{print $3}'", shell=True, stdout=subprocess.PIPE).stdout.read().decode("utf8").split('\n') +############################################################################### + ############################################################################### def getOarNbFreeGpuPerNode() : gpus = getOarNbGpuPerNode() + notAlive = getOarNotAliveNodes() usedGpus = getOarNbUsedGpuPerNode() for gpu in gpus : gpus[gpu] -= usedGpus[gpu] if gpu in usedGpus else 0 + for host in notAlive : + gpus[host] = 0 + return gpus ############################################################################### -- GitLab