Permalink
Browse files

refactored away session.elapsed property (moved logic to Task.work)

  • Loading branch information...
lirazsiri committed Dec 19, 2012
1 parent 3b6ea89 commit b506bb6f1a34b98d3061cd3de1e2554031303faa
Showing with 4 additions and 6 deletions.
  1. +0 −5 cloudtask/session.py
  2. +4 −1 cloudtask/task.py
View
@@ -206,7 +206,6 @@ def __init__(self, sessions_path, id=None):
self._wlog = None
self._mlog = None
- self.started = time.time()
self.key = TempSessionKey()
self.id = id
@@ -222,10 +221,6 @@ def taskconf(self, val=UNDEFINED):
print >> file(path, "w"), pprint.pformat(d)
taskconf = property(taskconf, taskconf)
- @property
- def elapsed(self):
- return time.time() - self.started
-
@property
def wlog(self):
if self._wlog:
View
@@ -375,6 +375,8 @@ def terminate(sig, f):
executor = None
+ work_started = time.time()
+
try:
executor = CloudExecutor(split, session, taskconf)
for job in jobs:
@@ -412,8 +414,9 @@ def terminate(sig, f):
total = len(session.jobs.finished) + len(session.jobs.pending)
print >> session.mlog
+
status("(%d seconds): %d/%d !OK - %d pending, %d timeouts, %d errors, %d OK" % \
- (session.elapsed, total - succeeded, total, len(session.jobs.pending), timeouts, errors, succeeded))
+ (time.time() - work_started, total - succeeded, total, len(session.jobs.pending), timeouts, errors, succeeded))
ok = (total - succeeded == 0)
return ok

0 comments on commit b506bb6

Please sign in to comment.