

def wait(self, jobs=None, timeout=(- 1)):
    'waits on one or more `jobs`, for up to `timeout` seconds.\n        \n        Parameters\n        ----------\n        \n        jobs : int, str, or list of ints and/or strs, or one or more AsyncResult objects\n                ints are indices to self.history\n                strs are msg_ids\n                default: wait on all outstanding messages\n        timeout : float\n                a time in seconds, after which to give up.\n                default is -1, which means no timeout\n        \n        Returns\n        -------\n        \n        True : when all msg_ids are done\n        False : timeout reached, some msg_ids still outstanding\n        '
    tic = time.time()
    if (jobs is None):
        theids = job.outstanding
    else:
        if isinstance(jobs, (int, str, AsyncResult)):
            jobs = [jobs]
        theids = set()
        for job in jobs:
            if isinstance(job, int):
                job = self.history[job]
            elif isinstance(job, AsyncResult):
                list(map(theids.add, job.msg_ids))
                continue
            theids.add(job)
    if (not theids.intersection(self.outstanding)):
        return True
    self.spin()
    while theids.intersection(self.outstanding):
        if ((timeout >= 0) and ((time.time() - tic) > timeout)):
            break
        time.sleep(0.001)
        self.spin()
    return (len(theids.intersection(self.outstanding)) == 0)

dataset/ETHPy150Open ipython/ipython-py3k/IPython/parallel/client/client.py Client.wait/VarMisuse@42/279 `self`->`job`