Skip to content
Snippets Groups Projects
Commit 2c655fd4 authored by Franck Dary's avatar Franck Dary
Browse files
parents b2e19864 1a97d4b6
Branches
No related tags found
No related merge requests found
...@@ -111,21 +111,31 @@ def getOarNbGpuPerNode() : ...@@ -111,21 +111,31 @@ def getOarNbGpuPerNode() :
############################################################################### ###############################################################################
def getOarNbUsedGpuPerNode() : def getOarNbUsedGpuPerNode() :
l = subprocess.Popen("oarstat -f | grep 'assigned_hostnames =\|propert' | grep -i 'gpu is not null' -C 1 | sed '0~2d' | sort | uniq -c | awk '{print $4,$1}'", shell=True, stdout=subprocess.PIPE).stdout.read().decode("utf8").split('\n') l = subprocess.Popen("oarstat -f | grep 'assigned_hostnames =\|propert\|wanted_resources' | grep -i 'gpu is not null' -B 2 | grep [^-]", shell=True, stdout=subprocess.PIPE).stdout.read().decode("utf8").split('\n')
res = {} res = {}
for line in l :
splited = line.split() for i in range(len(l)//3) :
if len(splited) != 2 : ressources = l[3*i]
continue hostname = l[3*i+1].split()[-1]
res[splited[0]] = int(splited[1]) cores = 1
gpunum = 1
if "core=" in ressources :
cores = int(ressources.split("core=")[-1].split('/')[0])
if "gpunum=" in ressources :
gpunum = int(ressources.split("gpunum=")[-1].split(',')[0])
if hostname not in res :
res[hostname] = 0
res[hostname] += cores * gpunum
return res return res
############################################################################### ###############################################################################
############################################################################### ###############################################################################
def getOarNotAliveNodes() : 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') res = 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')
return [node for node in res if len(node) > 0]
############################################################################### ###############################################################################
############################################################################### ###############################################################################
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment