Wait for all busy employees to finish.
436397
public function waitOnEmployees()
    {
        foreach ($this->employees as $employee) {
            if ($employee->isBusy()) {
                $employee->getWorkState(true);
            }
        }
    }
533242
def StartAndWait(self):
        """"""
        self.StartTask()
        self.WaitUntilTaskDone(pydaq.DAQmx_Val_WaitInfinitely)
        self.ClearTask()
291880
public void waitTillAllUpdatesExecuted() throws InterruptedException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "waitTillAllUpdatesExecuted");
    synchronized (this)
    {
      while (enqueuedUnits.size() > 0 || executing)
      {
        try
        {
          this.wait();
        }
        catch (InterruptedException e)
        {
          // No FFDC code needed
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "waitTillAllUpdatesExecuted", e);
          throw e;
        }
      }
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "waitTillAllUpdatesExecuted");
  }
850759
def killall(self, wait = None):
        
        with self.tasks.mutex:
            self.tasks.queue.clear()
        self.count_lock.acquire()
        self.kill(self.workers)
        self.count_lock.release()
        self.kill_event.wait(wait)
1170051
def as_completed(jobs):
  '''  '''

  jobs = tuple(jobs)
  event = threading.Event()
  callback = lambda f, ev: event.set()
  [job.add_listener(Job.SUCCESS, callback, once=True) for job in jobs]
  [job.add_listener(Job.ERROR, callback, once=True) for job in jobs]

  while jobs:
    event.wait()
    event.clear()

    jobs, finished = split_list_by(jobs, lambda x: x.finished)
    for job in finished:
      yield job
378384
public function doneWorking()
	{
		$this->currentJob = null;
		Resque_Stat::incr('processed');
		Resque_Stat::incr('processed:' . (string)$this);
		Resque::redis()->del('worker:' . (string)$this);
	}
264432
def flush(self):
        """"""
        while not self._queue.empty():
            self._queue.get()
            self._queue.task_done()
        self.close()
702569
def finish (self):
        """"""
        if not self.urlqueue.empty():
            # This happens when all checker threads died.
            self.cancel()
        for t in self.threads:
            t.stop()
1259233
def wait(self, interval=SGE_WAIT):
        """"""
        finished = False
        while not finished:
            time.sleep(interval)
            interval = min(2 * interval, 60)
            finished = os.system("qstat -j %s > /dev/null" % (self.name))
713352
def wait_for_jobs(self, job_ids, timeout, delay):
        """"""
        if self.skip:
            return

        logger.debug("Waiting up to %d sec for completion of the job IDs %s", timeout, job_ids)

        remaining_job_ids = set(job_ids)
        found_jobs = []

        countdown = timeout
        while countdown > 0:
            matched_jobs = self.find_jobs(remaining_job_ids)
            if matched_jobs:
                remaining_job_ids.difference_update({job["id"] for job in matched_jobs})
                found_jobs.extend(matched_jobs)
            if not remaining_job_ids:
                return found_jobs
            time.sleep(delay)
            countdown -= delay

        logger.error(
            "Timed out while waiting for completion of the job IDs %s. Results not updated.",
            list(remaining_job_ids),
        )
757560
function ready() {
        _ready = true;

        var len;
        while((len = runQueue.length)) {
            // store a reference to the queue before we reset it
            var queue = runQueue;

            // clear out the queue
            runQueue = [];

            // run all of the current jobs
            for (var i = 0; i < len; i++) {
                var args = queue[i];
                run(args[0], args[1]);
            }

            // stop running jobs in the queue if we change to not ready
            if (!_ready) {
                break;
            }
        }
    }
1296331
function callWaitAllCallbacks() {
    for (var i = 0; i < waitAllCallbacks.length; i++) {
        waitAllCallbacks[0]();
    }
    waitAllCallbacks.splice(0, waitAllCallbacks.splice.length);
    clearInterval(intervalId);
    intervalId = null;
}
46118
def wait(self, until=0):
        
        if self._count != until:
            self._waiters.setdefault(until, []).append(compat.getcurrent())
            scheduler.state.mainloop.switch()
487885
def flush(self):
        

        done = threading.Event()

        def _callback():
            done.set()

        self.defer(_callback)
        done.wait()
144286
public boolean waitForCompletion(boolean verbose
                                   ) throws IOException, InterruptedException,
                                            ClassNotFoundException {
    if (state == JobState.DEFINE) {
      submit();
    }
    if (verbose) {
      jobClient.monitorAndPrintJob(conf, info);
    } else {
      info.waitForCompletion();
    }
    return isSuccessful();
  }
1039169
public void waitOnBackgroundOp()
  {
    ExecutorService jobRunner = getJobRunner();
    if( jobRunner != null )
    {
      final Object wait = new Object();
      synchronized( wait ) //## wtf?
      {
        BackgroundOperation.instance().doBackgroundOp( () -> {
          synchronized( wait )
          {
            wait.notifyAll();
          }
        }, false );

        try
        {
          wait.wait();
        }
        catch( InterruptedException e )
        {
          //ignore
        }
      }
    }
  }
325244
def killall(self, wait = None):
        
        self.queue.close()
        self.count_lock.acquire()
        self.kill(self.shared['workers'])
        self.count_lock.release()
        self.tasks.close()
        self.terminate()
        self.kill_event.wait(wait)