Commit b895be74 authored by Andrew McNab's avatar Andrew McNab
Browse files

Get resources from argv[5]

parent 62a013a2
......@@ -62,18 +62,11 @@ job_id = sys.argv[1]
jobfeaturesDir = homeDir + '/jobfeatures-' + job_id
os.mkdir(jobfeaturesDir)
open(jobfeaturesDir + '/job_id', 'w').write(job_id)
jobfeatures = {}
try:
jobfeatures['allocated_cpu'] = int(os.environ['PBS_NUM_PPN'])
except:
jobfeatures['allocated_cpu'] = 1
jobfeatures['allocated_cpu'] = 1
open(jobfeaturesDir + '/allocated_cpu', 'w').write(str(jobfeatures['allocated_cpu']))
try:
hs06 = float(open('/etc/machinefeatures/hs06','r').readline())
except:
......@@ -94,6 +87,13 @@ jobstart_secs = int(time.time())
open(jobfeaturesDir + '/jobstart_secs', 'w').write(str(jobstart_secs))
# Examine the 5th argument, for resource limits
try:
# if just 1 processor-per-node then "nodes=1", but if 8, say, then "nodes=1:ppn=8"
ppnMatchObject = re.search('nodes=[0-9]*:ppn=([0-9]*)', sys.argv[5])
jobfeatures['allocated_cpu'] = int(ppnMatchObject.group(1))
except:
pass
try:
wallMatchObject = re.search('walltime=([0-9]*):([0-9]*):([0-9]*)', sys.argv[5])
jobfeatures['wall_limit_secs'] = int(wallMatchObject.group(1)) * 3600 + int(wallMatchObject.group(2)) * 60 + int(wallMatchObject.group(3))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment