Helper method, waits for state on a set of servers.
 * set<~Array> of servers to operate on
 * state<~String> state to wait for
346488
def state_wait(set, state)
      # do a special wait, if waiting for operational (for dns)
      if state == "operational"
        set.each { |server| server.wait_for_operational_with_dns }
      else
        set.each { |server| server.wait_for_state(state) }
      end
    end
855035
def wait_until_available(resource):
  """'"""
  while True:
    resource.load()
    if resource.state == 'available':
      break
    time.sleep(RETRY_INTERVAL_SEC)
1077866
def wait_for_states(self, timeout=40, *states):
        

        state = self.get_attribute('state')
        for _ in range(timeout):
            if state in states:
                return
            time.sleep(1)
            state = self.get_attribute('state')
        raise TgnError('Failed to reach states {}, port state is {} after {} seconds'.format(states, state, timeout))
980720
public void process(String[] args, T state) {
    process(new ArrayQueue<String>(args), state);
  }
20429
def wait_for_jobs(jobs):
    

    all_running = False
    while not all_running:
        all_running = True
        time.sleep(5)
        for job in jobs:
            job.refresh()
            scheduled = getattr(job, "scheduled_at", None)
            if scheduled is not None:
                logger.info("Waiting for %s on %s [%s]" % (job.uid,
                                                           job.site,
                                                           _date2h(scheduled)))
            all_running = all_running and job.state == "running"
            if job.state == "error":
                raise Exception("The job %s is in error state" % job)
    logger.info("All jobs are Running !")
8432
def wait(i, &block)
      @order[i] = block
      return unless i == @current

      while order[@current]
        order.delete(@current).call
        @current += 1
      end
    end
933819
def wait_for(self, ports, interval=1.0, timeout=30, to_start=True):
        
        threads = []
        queue = Queue.Queue()

        for port in ports:
            threads.append(threading.Thread(target=wait_for_host, args=(
                port, interval, timeout, to_start, queue,
                self.ssl_pymongo_options)))

        if self.args and 'verbose' in self.args and self.args['verbose']:
            print("waiting for nodes %s..."
                  % ('to start' if to_start else 'to shutdown'))

        for thread in threads:
            thread.start()

        for thread in threads:
            thread.join()

        # get all results back and return tuple
        return tuple(queue.get_nowait() for _ in ports)
24489
def ensure_started(self):
        
        # server is either starting or stopping (or error)
        if self.state in ['maintenance', 'error']:
            self._wait_for_state_change(['stopped', 'started'])

        if self.state == 'stopped':
            self.start()
            self._wait_for_state_change(['started'])

        if self.state == 'started':
            return True
        else:
            # something went wrong, fail explicitly
            raise Exception('unknown server state: ' + self.state)
563981
def waitStarted(self):
        """"""
        ns = None
        while not ns:
            try:
                time.sleep(3)
                ns = Pyro.naming.NameServerLocator(
                    identification=self.identification).getNS()
            except Pyro.errors.NamingError as er:
                pass
974232
def wait_for_state(vmid, state, timeout=300):
    '''
    
    '''
    start_time = time.time()
    node = get_vm_status(vmid=vmid)
    if not node:
        log.error('wait_for_state: No VM retrieved based on given criteria.')
        raise SaltCloudExecutionFailure

    while True:
        if node['status'] == state:
            log.debug('Host %s is now in "%s" state!', node['name'], state)
            return True
        time.sleep(1)
        if time.time() - start_time > timeout:
            log.debug('Timeout reached while waiting for %s to become %s',
                      node['name'], state)
            return False
        node = get_vm_status(vmid=vmid)
        log.debug('State for %s is: "%s" instead of "%s"',
                  node['name'], node['status'], state)
901878
def wait(state)
      if !LXC::Shell.valid_state?(status.state)
        raise ArgumentError, "Invalid container state: #{state}"
      end

      run("wait", "-s", state)
    end
798562
def wait_for_state_change(self, state: str, waitsec) -> str:
        """"""
        payload = """<ns1:waitForControllerStateChange1
                     xmlns:ns1=\"utcs\" xsi:type=\"ns1:WSControllerState\">
                     <ns1:state xsi:type=\"xsd:string\">{state}</ns1:state>
                     </ns1:waitForControllerStateChange1>
                     <ns2:waitForControllerStateChange2
                     xmlns:ns2=\"utcs\" xsi:type=\"xsd:int\">
                     {wait}</ns2:waitForControllerStateChange2>
                     """.format(state=state, wait=waitsec)
        xdoc = self.connection.soap_action('/ws/ControllerService',
                                           'waitForControllerStateChange',
                                           payload)
        if xdoc:
            return xdoc.find(
                './SOAP-ENV:Body/ns1:waitForControllerStateChange3/ns1:state',
                IHCSoapClient.ihcns).text
        return False
842614
public static void waitWhileState(final DeviceProxy proxy, final DevState waitState, final long timeout,
	    final long pollingTime) throws DevFailed, TimeoutException {
	final long time0 = System.currentTimeMillis();

	while (proxy.state().equals(waitState)) {
	    if (System.currentTimeMillis() - time0 > timeout) {
		throw new TimeoutException(
			"Stateutilities.waitWhileState : timeout reached while waiting end of state "
				+ TangoConst.Tango_DevStateName[waitState.value()]);
	    }
	    try {
		Thread.sleep(pollingTime);
	    } catch (final InterruptedException e) {
		// ignore
	    }
	}

    }
259344
public void setServers(java.util.Collection<ListedServer> servers) {
        if (servers == null) {
            this.servers = null;
            return;
        }

        this.servers = new java.util.ArrayList<ListedServer>(servers);
    }
1142469
def _wait_for_finishing(self):
        """"""
        self.state_machine_running = True
        self.__running_state_machine.join()
        self.__set_execution_mode_to_finished()
        self.state_machine_manager.active_state_machine_id = None
        plugins.run_on_state_machine_execution_finished()
        # self.__set_execution_mode_to_stopped()
        self.state_machine_running = False
384264
public final void waitForFullService() {
        if (!m_state.isInitialized()) {
            throw new RuntimeException("Service has not been initialized");
        }
        synchronized (m_stateChangeLock) {
            // Loop until state >= RUNNING
            while (!m_state.isRunning()) {
                try {
                    m_stateChangeLock.wait();
                } catch (InterruptedException e) {
                }
            }
            if (m_state.isStopping()) {
                throw new RuntimeException("Service " + this.getClass().getSimpleName() +
                                           " failed before reaching running state");
            }
        }
    }
520090
def wait(*args)
      pattern = args.pop
      unless pattern
        raise ArgumentError, 'Please provide condition to wait for'
      end

      run(*args) do |out, _|
        raise if out =~ /#{pattern}/
      end
    rescue ExitError
      # noop
    end