diff --git a/UD_any/launchBatches.py b/UD_any/launchBatches.py index cae8bcd42c7516a94f755c1b3bf7168e51712fc3..2e0b3df8e19f2c44c5a5c1925efc4182c0fbe357 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 ###############################################################################