Commit 4d8d9ac5 authored by Wout De Nolf's avatar Wout De Nolf

[oarresource] skip default properties when parsing cli job properties

parent 217cc9d2
......@@ -166,16 +166,32 @@ class Job(object):
def duration(self):
"""Time since scheduled
def runtime(self):
"""Effective execution time, excluding queue time
return self._time_diff('scheduledStart', 'stopTime')
dt = self._time_diff('stopTime', 'startTime')
return max(dt,datetime.timedelta(seconds=0))
def runtime(self):
"""Time since started
def time_scheduled(self):
"""Time this job was scheduled, excluding queue and runtime
dt = self._time_diff('startTime', 'scheduledStart')
return max(dt,datetime.timedelta(seconds=0))
def time_enqueued(self):
"""Time this job was enqueue (not scheduled for execution)
dt = self._time_diff('scheduledStart', 'submissionTime')
return max(dt,datetime.timedelta(seconds=0))
def time_to_start(self):
"""Time till start
return self._time_diff('startTime', 'stopTime')
dt = self._time_diff('startTime',
return max(dt,datetime.timedelta(seconds=0))
def stderr_file(self):
......@@ -346,17 +362,32 @@ class Job(object):
if value:
stats['walltime'] = datetime.timedelta(seconds=int(value))
def _time_diff(self, start, end):
stats = self.stats
start = stats[start]
if start:
end = stats[end]
if end:
return end-start
return - start
def _time_diff(self, end, start):
:param end: None (now)
:type end: str or datetime or None
:param start: None (now)
:type start: str or datetime or None
:return timedelta:
with self.fixed_stats():
return self._get_time(end)-self._get_time(start)
def _get_time(self, tm):
:param tm: None (now)
:type tm: str or datetime or None
:return datetime:
if isinstance(tm,datetime.datetime):
return tm
return datetime.timedelta(seconds=0)
tm = self[tm]
if not tm:
tm =
return tm
def _raise_if_error(self, err, code, msg):
if code:
......@@ -40,7 +40,9 @@ def str2walltime(s):
h, m, s = s.split(':')
return datetime.timedelta(hours=int(h), minutes=int(m), seconds=int(s))
property_pattern = re.compile('(\w+) *([>=<]+) *\'?([\w\d]+)\'?')
property_pattern = re.compile('(\w+)([>=<]+)\'?([\w\d]+)\'?')
# Includes the default ones (space around operator):
#property_pattern = re.compile('(\w+) *([>=<]+) *\'?([\w\d]+)\'?')
class Resource(object):
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