Commit 0ded0726 authored by Andrew McNab's avatar Andrew McNab
Browse files

Fix bug found by John Hill

parent 0314fc71
......@@ -67,22 +67,6 @@ open(jobfeaturesDir + '/job_id', 'w').write(job_id)
jobfeatures = {}
jobfeatures['allocated_cpu'] = 1
try:
hs06 = float(open('/etc/machinefeatures/hs06','r').readline())
except:
hs06 = None
try:
total_cpu = int(open('/etc/machinefeatures/total_cpu','r').readline())
except:
total_cpu = None
if hs06 and total_cpu:
# Simple pro-rata allocation of total hs06 depending on processors for this job
hs06_job = (jobfeatures['allocated_cpu'] * hs06) / total_cpu
else:
hs06_job = None
jobstart_secs = int(time.time())
open(jobfeaturesDir + '/jobstart_secs', 'w').write(str(jobstart_secs))
......@@ -136,19 +120,7 @@ try:
except:
fromSysconfig = ''
# hs06_job is a float so special handling
if 'hs06_job=' in fromRun + fromSysconfig:
try:
matchObject = re.search("hs06_job=([0-9.]*)", fromSysconfig + fromRun)
hs06_job = float(matchObject.group(1))
except:
pass
if hs06_job:
# Has been defined here or before
open(jobfeaturesDir + '/hs06_job', 'w').write('%.2f' % hs06_job)
# The rest are integers so handle with a list
# These are all integers so handle with a list
for key in ['allocated_cpu', 'wall_limit_secs', 'cpu_limit_secs',
'max_rss_bytes', 'max_swap_bytes', 'scratch_limit_bytes']:
......@@ -162,3 +134,32 @@ for key in ['allocated_cpu', 'wall_limit_secs', 'cpu_limit_secs',
if key in jobfeatures:
open(jobfeaturesDir + '/' + key, 'w').write(str(jobfeatures[key]))
# Try to get/calculate hs06_job
hs06_job = None
if 'hs06_job=' in fromRun + fromSysconfig:
try:
matchObject = re.search("hs06_job=([0-9.]*)", fromSysconfig + fromRun)
hs06_job = float(matchObject.group(1))
except:
pass
if not hs06_job:
try:
hs06 = float(open('/etc/machinefeatures/hs06','r').readline())
except:
hs06 = None
try:
total_cpu = int(open('/etc/machinefeatures/total_cpu','r').readline())
except:
total_cpu = None
if hs06 and total_cpu:
# Simple pro-rata allocation of total hs06 depending on processors for this job
hs06_job = (jobfeatures['allocated_cpu'] * hs06) / total_cpu
if hs06_job:
# We got it from somewhere
open(jobfeaturesDir + '/hs06_job', 'w').write('%.2f' % hs06_job)
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