Skip to content
Snippets Groups Projects
Commit 2c655fd4 authored by Franck Dary's avatar Franck Dary
Browse files
parents b2e19864 1a97d4b6
No related branches found
No related tags found
No related merge requests found
......@@ -111,21 +111,31 @@ def getOarNbGpuPerNode() :
###############################################################################
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 = {}
for line in l :
splited = line.split()
if len(splited) != 2 :
continue
res[splited[0]] = int(splited[1])
for i in range(len(l)//3) :
ressources = l[3*i]
hostname = l[3*i+1].split()[-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
###############################################################################
###############################################################################
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