Starts a Pelix framework and waits for it to stop
775563
def main():
    
    # Prepare the framework, with iPOPO and the shell console
    # Warning: we only use the first argument of this method, a list of bundles
    framework = pelix.framework.create_framework((
        # iPOPO
        "pelix.ipopo.core",
        # Shell core (engine)
        "pelix.shell.core",
        # Text console
        "pelix.shell.console"))

    # Start the framework, and the pre-installed bundles
    framework.start()

    # Get the bundle context of the framework, i.e. the link between the
    # framework starter and its content.
    context = framework.get_bundle_context()

    # Start the spell dictionary bundles, which provide the dictionary services
    context.install_bundle("spell_dictionary_EN").start()
    context.install_bundle("spell_dictionary_FR").start()

    # Start the spell checker bundle, which provides the spell checker service.
    context.install_bundle("spell_checker").start()

    # Sample usage of the spell checker service
    # 1. get its service reference, that describes the service itself
    ref_config = context.get_service_reference("spell_checker_service")

    # 2. the use_service method allows to grab a service and to use it inside a
    # with block. It automatically releases the service when exiting the block,
    # even if an exception was raised
    with use_service(context, ref_config) as svc_config:
        # Here, svc_config points to the spell checker service
        passage = "Welcome to our framwork iPOPO"
        print("1. Testing Spell Checker:", passage)
        misspelled_words = svc_config.check(passage)
        print(">  Misspelled_words are:", misspelled_words)

    # Start the spell client bundle, which provides a shell command
    context.install_bundle("spell_client").start()

    # Wait for the framework to stop
    framework.wait_for_stop()
134358
def wait_for_string(self, expected_string, timeout=60):
        """"""
        ADMIN_USERNAME_PROMPT = re.compile("Admin Username:")
        ADMIN_PASSWORD_PROMPT = re.compile("Password:")

        # Big thanks to calvados developers for make this FSM such complex ;-)
        #                    0                         1                        2                        3
        events = [self.syntax_error_re, self.connection_closed_re, self.authentication_error_re, expected_string,
                  #        4                  5                 6             7               8
                  self.press_return_re, self.more_re, pexpect.TIMEOUT, pexpect.EOF, self.calvados_re,
                  #     9                             10                  11                     12
                  self.calvados_connect_re, self.calvados_term_length, ADMIN_USERNAME_PROMPT, ADMIN_PASSWORD_PROMPT]

        # add detected prompts chain
        events += self.device.get_previous_prompts()  # without target prompt

        self.log("Expecting: {}".format(pattern_to_str(expected_string)))
        self.log("Calvados prompt: {}".format(pattern_to_str(self.calvados_re)))

        transitions = [
            (ADMIN_USERNAME_PROMPT, [0], 6, partial(a_send_username, self.device.node_info.username), 5),
            (ADMIN_PASSWORD_PROMPT, [0, 6], 0, partial(a_send_password, self.device.node_info.password), 5),
            (self.authentication_error_re, [0], -1,
             ConnectionAuthenticationError("Admin plane authentication failed", self.device.hostname), 0),
            (self.syntax_error_re, [0], -1, CommandSyntaxError("Command unknown", self.device.hostname), 0),
            (self.connection_closed_re, [0], 1, a_connection_closed, 10),
            (pexpect.TIMEOUT, [0, 2], -1, CommandTimeoutError("Timeout waiting for prompt", self.device.hostname), 0),
            (pexpect.EOF, [0, 1], -1, ConnectionError("Unexpected device disconnect", self.device.hostname), 0),
            (self.more_re, [0], 0, partial(a_send, " "), 10),
            (expected_string, [0, 1], -1, a_expected_prompt, 0),
            (self.calvados_re, [0], -1, a_expected_prompt, 0),
            (self.press_return_re, [0], -1, a_stays_connected, 0),
            (self.calvados_connect_re, [0], 2, None, 0),
            # admin command to switch to calvados
            (self.calvados_re, [2], 3, None, _C['calvados_term_wait_time']),
            # getting the prompt only
            (pexpect.TIMEOUT, [3], 0, partial(a_send, "\r\r"), timeout),
            # term len
            (self.calvados_term_length, [3], 4, None, 0),
            # ignore for command start
            (self.calvados_re, [4], 5, None, 0),
            # ignore for command start
            (self.calvados_re, [5], 0, a_store_cmd_result, 0),
        ]

        for prompt in self.device.get_previous_prompts():
            transitions.append((prompt, [0, 1], 0, a_unexpected_prompt, 0))

        fsm = FSM("WAIT-4-STRING", self.device, events, transitions, timeout=timeout)
        return fsm.run()
150785
def start(self):
        
        NonBlockingStreamReader._stream_mtx.acquire()
        NonBlockingStreamReader._streams.append(self._descriptor)
        NonBlockingStreamReader._stream_mtx.release()
343889
public void start() {
		try {
			Iterator iter = configLoadedList.keySet().iterator();
			while (iter.hasNext()) {
				String configFile = (String) iter.next();
				Debug.logVerbose("[JdonFramework] start configFile = " + configFile, module);
				ConfigureReader configureLoader = (ConfigureReader) configLoadedList.get(configFile);
				Map modelMappings = configureLoader.load();
				mps.putAll(modelMappings);

				Iterator mpsIter = modelMappings.keySet().iterator();
				while (mpsIter.hasNext()) {
					String formName = (String) mpsIter.next();
					build(formName);
				}
			}
			configLoadedList.clear();
		} catch (Exception ex) {
			Debug.logError("[JdonFramework] !!!!!!!framework started error: " + ex, module);
		}
	}
1168140
def wait_for_port_open(self, postmaster, timeout):
        """"""
        for _ in polling_loop(timeout):
            with self._cancellable_lock:
                if self._is_cancelled:
                    return False

            if not postmaster.is_running():
                logger.error('postmaster is not running')
                self.set_state('start failed')
                return False

            isready = self.pg_isready()
            if isready != STATE_NO_RESPONSE:
                if isready not in [STATE_REJECT, STATE_RUNNING]:
                    logger.warning("Can't determine PostgreSQL startup status, assuming running")
                return True

        logger.warning("Timed out waiting for PostgreSQL to start")
        return False
498964
def run(self):
        ''''''
        while not self.wait(self.delay()):
            try:
                logger.info('Invoking callback %s', self.callback)
                self.callback()
            except StandardError:
                logger.exception('Callback failed')
356285
def wait_until_finished(self):
        """"""
        try:
            self.thread.join()
        except KeyboardInterrupt:
            self._logger.debug('Keyboard interrupt detected, stopping driver.')
            self._active = False
            self._wake_queue()
1030317
def _wait_for_machine_finish(self, name):
        
        # TODO: rewrite it using probes module in utils
        for foo in range(constants.DEFAULT_RETRYTIMEOUT):
            time.sleep(constants.DEFAULT_SLEEP)
            out = run_cmd(
                ["machinectl", "--no-pager", "status", name],
                ignore_status=True, return_output=True)
            if out != 0:
                return True
        raise ConuException(
            "Unable to stop machine %s within %d" %
            (name, constants.DEFAULT_RETRYTIMEOUT))
962360
def start_and_wait(self, *args, **kwargs):
        
        self.start(*args, **kwargs)
        retcode = self.wait()
        return retcode
633544
def wait(self, timeout):
        ''''''
        logger.debug('Waiting for %fs', timeout)
        return self._event.wait(timeout)
516290
def wait_init(self):
        
        init_done = self.init_done.wait(timeout=self.init_wait_timeout)
        if not init_done:
            if hasattr(self, "peek"):
                app = self.config.get("application")
                if app:
                    bef_init_cmds = app.get("cli_ready_trigger")
                    if bef_init_cmds in self.peek():  # pylint: disable=no-member
                        init_done = True
        return init_done
1326600
function waitForStartup(err, pid) {
        if (err) {
            throw new Error('Couldn\'t start ' + bin);
        }

        if (pid || child.exitCode !== null) {
            child.emit('started');
        } else {
            setTimeout(function () {
                pidof(bin, waitForStartup);
            }, 100);
        }
    }
617209
public void waitForReady() {
        if (!isLoaded) {
            synchronized (LOAD_LOCK) {
                if (!isLoaded) {
                    try {
                        long start = Runtime.getActorTime();
                        LOAD_LOCK.wait();
                        Log.d(TAG, "Waited for startup in " + (Runtime.getActorTime() - start) + " ms");
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }
863777
def try_start
      return if @backoff.wait?
      @backoff.started
      @self_started = true
      @killed = false
      if @pid = fork
        @pids << @pid
        # still in the listener
        log "Forked worker #{@pid}"
      else
        # In case we get a signal before resque is ready for it.
        Resqued::Listener::ALL_SIGNALS.each { |signal| trap(signal, 'DEFAULT') }
        trap(:QUIT) { exit! 0 } # If we get a QUIT during boot, just spin back down.
        $0 = "STARTING RESQUE FOR #{queues.join(',')}"
        resque_worker = @worker_factory.call(queues)
        @config.after_fork(resque_worker)
        resque_worker.work(@interval || 5)
        exit 0
      end
    end
88382
def main(argv=None):
    
    # Parse arguments
    parser = argparse.ArgumentParser(
        prog="pelix.shell.console",
        parents=[make_common_parser()],
        description="Pelix Shell Console",
    )

    # Parse arguments
    args = parser.parse_args(argv)

    # Handle arguments
    init = handle_common_arguments(args)

    # Set the initial bundles
    bundles = [
        "pelix.ipopo.core",
        "pelix.shell.core",
        "pelix.shell.ipopo",
        "pelix.shell.completion.pelix",
        "pelix.shell.completion.ipopo",
        "pelix.shell.console",
    ]
    bundles.extend(init.bundles)

    # Use the utility method to create, run and delete the framework
    framework = pelix.create_framework(
        remove_duplicates(bundles), init.properties
    )
    framework.start()

    # Instantiate components
    init.instantiate_components(framework.get_bundle_context())

    try:
        framework.wait_for_stop()
    except KeyboardInterrupt:
        framework.stop()
1230304
def wait(self):
        
        try:
            SpawningProxy(self.containers, abort_on_error=True).wait()
        except Exception:
            # If a single container failed, stop its peers and re-raise the
            # exception
            self.stop()
            raise
770185
def wait(self, timeout=15):
        

        Probe(timeout=timeout, fnc=self.is_ready, expected_retval=True).run()