Show More
@@ -31,15 +31,6 b' from IPython.parallel import error' | |||||
31 | # Functions |
|
31 | # Functions | |
32 | #----------------------------------------------------------------------------- |
|
32 | #----------------------------------------------------------------------------- | |
33 |
|
33 | |||
34 | def _total_seconds(td): |
|
|||
35 | """timedelta.total_seconds was added in 2.7""" |
|
|||
36 | try: |
|
|||
37 | # Python >= 2.7 |
|
|||
38 | return td.total_seconds() |
|
|||
39 | except AttributeError: |
|
|||
40 | # Python 2.6 |
|
|||
41 | return 1e-6 * (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) |
|
|||
42 |
|
||||
43 | def _raw_text(s): |
|
34 | def _raw_text(s): | |
44 | display_pretty(s, raw=True) |
|
35 | display_pretty(s, raw=True) | |
45 |
|
36 | |||
@@ -338,7 +329,7 b' class AsyncResult(object):' | |||||
338 | # handle single_result AsyncResults, where ar.stamp is single object, |
|
329 | # handle single_result AsyncResults, where ar.stamp is single object, | |
339 | # not a list |
|
330 | # not a list | |
340 | end = end_key(end) |
|
331 | end = end_key(end) | |
341 |
return |
|
332 | return (end - start).total_seconds() | |
342 |
|
333 | |||
343 | @property |
|
334 | @property | |
344 | def progress(self): |
|
335 | def progress(self): | |
@@ -361,7 +352,7 b' class AsyncResult(object):' | |||||
361 | stamp = self._client.metadata[msg_id]['submitted'] |
|
352 | stamp = self._client.metadata[msg_id]['submitted'] | |
362 | if stamp and stamp < submitted: |
|
353 | if stamp and stamp < submitted: | |
363 | submitted = stamp |
|
354 | submitted = stamp | |
364 |
return |
|
355 | return (now-submitted).total_seconds() | |
365 |
|
356 | |||
366 | @property |
|
357 | @property | |
367 | @check_ready |
|
358 | @check_ready | |
@@ -372,7 +363,7 b' class AsyncResult(object):' | |||||
372 | """ |
|
363 | """ | |
373 | t = 0 |
|
364 | t = 0 | |
374 | for md in self._metadata: |
|
365 | for md in self._metadata: | |
375 |
t += |
|
366 | t += (md['completed'] - md['started']).total_seconds() | |
376 | return t |
|
367 | return t | |
377 |
|
368 | |||
378 | @property |
|
369 | @property |
General Comments 0
You need to be logged in to leave comments.
Login now