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

Full set of key/values

parent 666d716e
......@@ -65,6 +65,12 @@ import time
os.umask(0022)
try:
fromMachineAd = open(os.environ['_CONDOR_MACHINE_AD'],'r').read()
except:
sys.stderr.write('Could not read $_CONDOR_MACHINE_AD file - exiting htcondor-jobfeatures')
sys.exit(10)
try:
fromJobAd = open(os.environ['_CONDOR_JOB_AD'],'r').read()
except:
......@@ -151,26 +157,25 @@ for key in ['allocated_cpu', 'wall_limit_secs', 'cpu_limit_secs',
# Examine the Job Ad, for resource limits
try:
cpusMatchObject = re.search('CpusProvisioned *= *([0-9]*)', fromJobAd)
jobfeatures['allocated_cpu'] = int(cpusMatchObject.group(1))
cpusMatchObject = re.search('CpusProvisioned *= *([0-9 +*/()-]*)', fromJobAd)
jobfeatures['allocated_cpu'] = int(eval(cpusMatchObject.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))
#except:
# pass
#
#try:
# cputimeMatchObject = re.search('cput=([0-9]*):([0-9]*):([0-9]*)', sys.argv[5])
# jobfeatures['cpu_limit_secs'] = int(cputimeMatchObject.group(1)) * 3600 + int(cputimeMatchObject.group(2)) * 60 + int(cputimeMatchObject.group(3))
#except:
# pass
try:
wallMatchObject = re.search('^MaxJobRetirementTime *= *([0-9 +*/()-]*)', fromMachineAd)
jobfeatures['wall_limit_secs'] = int(eval(wallMatchObject.group(1)))
except:
pass
if not 'cpu_limit_secs' in jobfeatures and 'wall_limit_secs' in jobfeatures:
# If not given in mjf files, we create a CPU seconds limit from wallclock
# and allocated CPUs/processors
jobfeatures['cpu_limit_secs'] = jobfeatures['wall_limit_secs'] * jobfeatures['allocated_cpu']
try:
rssMatchObject = re.search('^MemoryProvisioned *= *([0-9]*)', fromJobAd)
rssInt = int(rssMatchObject.group(1))
rssMatchObject = re.search('^MemoryProvisioned *= *([0-9 +*/()-]*)', fromJobAd)
rssInt = int(eval(rssMatchObject.group(1)))
except:
pass
else:
......@@ -178,8 +183,8 @@ else:
jobfeatures['max_rss_bytes'] = rssInt * 1000000
try:
scratchMatchObject = re.search('^DiskProvisioned *= *([0-9]*)', fromJobAd)
scratchInt = int(rssMatchObject.group(1))
scratchMatchObject = re.search('^DiskProvisioned *= *([0-9 +*/()-]*)', fromJobAd)
scratchInt = int(eval(rssMatchObject.group(1)))
except:
pass
else:
......
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