environment/lib/python2.7/site-packages/IPython/parallel/client/asyncresult.py
def wait(self, timeout=-1):
        """wait for result to complete."""
        start = time.time()
        if self._ready:
            return
        local_ids = filter(lambda msg_id: msg_id in self._client.outstanding, self.msg_ids)
        local_ready = self._client.wait(local_ids, timeout)
        if local_ready:
            remote_ids = filter(lambda msg_id: msg_id not in self._client.results, self.msg_ids)
            if not remote_ids:
                self._ready = True
            else:
                rdict = self._client.result_status(remote_ids, status_only=False)
                pending = rdict['pending']
                while pending and (timeout < 0 or time.time() < start+timeout):
                    rdict = self._client.result_status(remote_ids, status_only=False)
                    pending = rdict['pending']
                    if pending:
                        time.sleep(0.1)
                if not pending:
                    self._ready = True
        if self._ready:
            try:
                results = map(self._client.results.get, self.msg_ids)
                self._result = results
                if self._single_result:
                    r = results[0]
                    if isinstance(r, Exception):
                        raise r
                else:
                    results = error.collect_exceptions(results, self._fname)
                self._result = self._reconstruct_result(results)
            except Exception, e:
                self._exception = e
                self._success = False
            else:
                self._success = True
            finally:
                self._metadata = map(self._client.metadata.get, self.msg_ids)
def wait(self, timeout=-1):
        start = time.time()
        if self._ready:
            return
        local_ids = filter(lambda msg_id: msg_id in self._client.outstanding, self.msg_ids)
        local_ready = self._client.wait(local_ids, timeout)
        if local_ready:
            remote_ids = filter(lambda msg_id: msg_id not in self._client.results, self.msg_ids)
            if not remote_ids:
                self._ready = True
            else:
                rdict = self._client.result_status(remote_ids, status_only=False)
                pending = rdict['pending']
                while pending and (timeout < 0 or time.time() < start+timeout):
                    rdict = self._client.result_status(remote_ids, status_only=False)
                    pending = rdict['pending']
                    if pending:
                        time.sleep(0.1)
                if not pending:
                    self._ready = True
        if self._ready:
            try:
                results = map(self._client.results.get, self.msg_ids)
                self._result = results
                if self._single_result:
                    r = results[0]
                    if isinstance(r, Exception):
                        raise r
                else:
                    results = error.collect_exceptions(results, self._fname)
                self._result = self._reconstruct_result(results)
            except Exception, e:
                self._exception = e
                self._success = False
            else:
                self._success = True
            finally:
                self._metadata = map(self._client.metadata.get, self.msg_ids)
def wait ( self , timeout = - 1 ) : start = time . time ( ) if self . _ready : return local_ids = filter ( lambda msg_id : msg_id in self . _client . outstanding , self . msg_ids ) local_ready = self . _client . wait ( local_ids , timeout ) if local_ready : remote_ids = filter ( lambda msg_id : msg_id not in self . _client . results , self . msg_ids ) if not remote_ids : self . _ready = True else : rdict = self . _client . result_status ( remote_ids , status_only = False ) pending = rdict [ 'pending' ] while pending and ( timeout < 0 or time . time ( ) < start + timeout ) : rdict = self . _client . result_status ( remote_ids , status_only = False ) pending = rdict [ 'pending' ] if pending : time . sleep ( 0.1 ) if not pending : self . _ready = True if self . _ready : try : results = map ( self . _client . results . get , self . msg_ids ) self . _result = results if self . _single_result : r = results [ 0 ] if isinstance ( r , Exception ) : raise r else : results = error . collect_exceptions ( results , self . _fname ) self . _result = self . _reconstruct_result ( results ) except Exception , e : self . _exception = e self . _success = False else : self . _success = True finally : self . _metadata = map ( self . _client . metadata . get , self . msg_ids )
wait for result to complete.
wait for result to complete .