except AttributeError: # Python 2.6 return 1e-6 * (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) def _raw_text(s): display_pretty(s, raw=True) #----------------------------------------------------------------------------- # Classes #----------------------------------------------------------------------------- # global empty tracker that's always done: finished_tracker = MessageTracker() @decorator def check_ready(f, self, *args, **kwargs): """Call spin() to sync state prior to calling the method.""" self.wait(0) if not self._ready: raise error.TimeoutError("result not ready") return f(self, *args, **kwargs) class AsyncResult(object): """Class for representing results of non-blocking calls. Provides the same interface as :py:class:`multiprocessing.pool.AsyncResult`.
def _handle_sent(self, f): """Resolve sent Future, build MessageTracker""" trackers = f.result() trackers = [t for t in trackers if t is not None] self._tracker = MessageTracker(*trackers) self._sent_event.set()