Run CWL on Arvados.
960269
def _run_arvados(args):
    
    assert not args.no_container, "Arvados runs require containers"
    assert "ARVADOS_API_TOKEN" in os.environ and "ARVADOS_API_HOST" in os.environ, \
        "Need to set ARVADOS_API_TOKEN and ARVADOS_API_HOST in environment to run"
    main_file, json_file, project_name = _get_main_and_json(args.directory)
    flags = ["--enable-reuse", "--api", "containers", "--submit", "--no-wait"]
    cmd = ["arvados-cwl-runner"] + flags + args.toolargs + [main_file, json_file]
    _run_tool(cmd)
963799
public function run()
    {
        if(version_compare(SWOOLE_VERSION, '4.1', '>='))
        {
            \Swoole\Runtime::enableCoroutine(true);
        }
        if(file_exists($this->socketFile))
        {
            unlink($this->socketFile);
        }
        go(function(){
            $this->socket = stream_socket_server('unix://' . $this->socketFile, $errno, $errstr);
            if(false === $this->socket)
            {
                throw new \RuntimeException(sprintf('Create unix socket server failed, errno: %s, errstr: %s', $errno, $errstr));
            }
            while(true)
            {
                $conn = stream_socket_accept($this->socket, 0);
                if(false === $conn)
                {
                    continue;
                }
                go(function() use($conn){
                    $this->parseConn($conn);
                });
            }
        });
    }
249266
def _run_wes(args):
    
    main_file, json_file, project_name = _get_main_and_json(args.directory)
    main_file = _pack_cwl(main_file)
    if args.host and "stratus" in args.host:
        _run_wes_stratus(args, main_file, json_file)
    else:
        opts = ["--no-wait"]
        if args.host:
            opts += ["--host", args.host]
        if args.auth:
            opts += ["--auth", args.auth]
        cmd = ["wes-client"] + opts + [main_file, json_file]
        _run_tool(cmd)
726460
def run(self):
        """"""
        self._assure_output_dir(self.output)
        companies = self.read()
        print '%s CNPJs found' % len(companies)

        pbar = ProgressBar(
            widgets=[Counter(), ' ', Percentage(), ' ', Bar(), ' ', Timer()],
            maxval=len(companies)).start()

        resolved = 0
        runner = Runner(companies, self.days, self.token)

        try:
            for data in runner:
                self.write(data)
                resolved = resolved + 1
                pbar.update(resolved)
        except KeyboardInterrupt:
            print '\naborted: waiting current requests to finish.'
            runner.stop()
            return

        pbar.finish()
159370
protected function run()
    {
        if (stripos(PHP_OS, 'win') === 0) {
           throw new \Exception('The WorkerManagerRunner only works on linux');
        }

        /** @var WorkerProcessManager $workerManager */
        $workerManager = $this->getServiceLocator()->get(WorkerProcessManager::SERVICE_ID);
        $workerManager->setLimitOfCpu($this->getOption('limitOfCpu'));
        $workerManager->setLimitOfMemory($this->getOption('limitOfMemory'));

        /** @var TaskSerializerService $taskSerializer */
        $taskSerializer = $this->getServiceLocator()->get(TaskSerializerService::SERVICE_ID);
        $queueService   = $this->getQueueService();
        $loop           = Factory::create();

        $interval = $this->getOption('interval');
        $loop->addPeriodicTimer($interval, function () use ($loop, $queueService, $taskSerializer, $workerManager) {
            if ($workerManager->canRun()) {
                $task = $queueService->dequeue();
                if ($task !== null) {
                    $cmd = $workerManager->getCommand();
                    $taskJson = base64_encode($taskSerializer->serialize($task));
                    $cmd = 'cd '.ROOT_PATH.' && '.$cmd.' -t '.$taskJson;

                    $process = new \React\ChildProcess\Process($cmd);
                    $process->start($loop);
                    $workerManager->addProcess($process);
                }

                unset($task);
            }
        });

        $loop->run();
    }
1018594
public function run()
    {
        require __DIR__.'/../../../../vendor/autoload.php';
        $handler_pool = new \Pool($this->API->settings['threading']['handler_workers']);
        $this->ready = true;
        while ($this->API->run_workers) {
            try {
                $this->API->datacenter->sockets[$this->current]->reading = true;
                //$this->logger->logger('RECEIVING');
                $error = $this->API->recv_message($this->current);
                $this->logger->logger('NOW HANDLE');
                $handler_pool->submit(new SocketHandler($this->API, $this->current, $error));
                $this->logger->logger('SUBMITTED');
                $this->API->datacenter->sockets[$this->current]->reading = false;
            } catch (\danog\MadelineProto\NothingInTheSocketException $e) {
                //$this->logger->logger('Nothing in the socket for dc '.$this->current, \danog\MadelineProto\Logger::VERBOSE);
            }
        }
        while ($number = $handler_pool->collect()) {
            $this->logger->logger(sprintf(\danog\MadelineProto\Lang::$current_lang['shutting_down_handler_pool'], $this->current, $number), \danog\MadelineProto\Logger::NOTICE);
        }
        $this->setGarbage();
    }
1260689
def run(self):
        '''
        
        '''
        import salt.runner
        self.parse_args()

        # Setup file logging!
        self.setup_logfile_logger()
        verify_log(self.config)
        profiling_enabled = self.options.profiling_enabled

        runner = salt.runner.Runner(self.config)
        if self.options.doc:
            runner.print_docs()
            self.exit(salt.defaults.exitcodes.EX_OK)

        # Run this here so SystemExit isn't raised anywhere else when
        # someone tries to use the runners via the python API
        try:
            if check_user(self.config['user']):
                pr = salt.utils.profile.activate_profile(profiling_enabled)
                try:
                    ret = runner.run()
                    # In older versions ret['data']['retcode'] was used
                    # for signaling the return code. This has been
                    # changed for the orchestrate runner, but external
                    # runners might still use it. For this reason, we
                    # also check ret['data']['retcode'] if
                    # ret['retcode'] is not available.
                    if isinstance(ret, dict) and 'retcode' in ret:
                        self.exit(ret['retcode'])
                    elif isinstance(ret, dict) and 'retcode' in ret.get('data', {}):
                        self.exit(ret['data']['retcode'])
                finally:
                    salt.utils.profile.output_profile(
                        pr,
                        stats_path=self.options.profiling_path,
                        stop=True)

        except SaltClientError as exc:
            raise SystemExit(six.text_type(exc))
589226
public function run()
	{
		\Aimeos\MShop\Index\Manager\Factory::create( $this->getContext() )->optimize();
	}
544156
def run():
    """"""
    # create a arg parser and configure it.
    parser = argparse.ArgumentParser(description='SharQ Server.')
    parser.add_argument('-c', '--config', action='store', required=True,
                        help='Absolute path of the SharQ configuration file.',
                        dest='sharq_config')
    parser.add_argument('-gc', '--gunicorn-config', action='store', required=False,
                        help='Gunicorn configuration file.',
                        dest='gunicorn_config')
    parser.add_argument('--version', action='version', version='SharQ Server %s' % __version__)
    args = parser.parse_args()

    # read the configuration file and set gunicorn options.
    config_parser = ConfigParser.SafeConfigParser()
    # get the full path of the config file.
    sharq_config  = os.path.abspath(args.sharq_config)
    config_parser.read(sharq_config)

    host = config_parser.get('sharq-server', 'host')
    port = config_parser.get('sharq-server', 'port')
    bind = '%s:%s' % (host, port)
    try:
        workers = config_parser.get('sharq-server', 'workers')
    except ConfigParser.NoOptionError:
        workers = number_of_workers()

    try:
        accesslog = config_parser.get('sharq-server', 'accesslog')
    except ConfigParser.NoOptionError:
        accesslog = None

    options = {
        'bind': bind,
        'workers': workers,
        'worker_class': 'gevent'  # required for sharq to function.
    }
    if accesslog:
        options.update({
            'accesslog': accesslog
        })

    if args.gunicorn_config:
        gunicorn_config = os.path.abspath(args.gunicorn_config)
        options.update({
            'config': gunicorn_config
        })

    print """
      ___ _              ___    ___
     / __| |_  __ _ _ _ / _ \  / __| ___ _ ___ _____ _ _
     \__ \ ' \/ _` | '_| (_) | \__ \/ -_) '_\ V / -_) '_|
     |___/_||_\__,_|_|  \__\_\ |___/\___|_|  \_/\___|_|

    Version: %s

    Listening on: %s
    """ % (__version__, bind)
    server = setup_server(sharq_config)
    SharQServerApplicationRunner(server.app, options).run()
1362720
def run(self):
        """"""
        args = []
        for arg in self.args:
            args.append(arg)
        Pyro.naming.main(args)
191210
public function run()
    {
        $MenuTypes = ['header', 'sidebar', 'footer'];

        foreach ($MenuTypes as $MenuType) {
            $Type = ['type' => $MenuType];

            factory(Menu::class, 5)->create($Type)->each(function ($u) use ($Type) {
                $u->children()->saveMany(factory(Menu::class, 2)->create($Type)
                    ->each(function ($p) use ($Type) {
                        $p->children()->saveMany(factory(Menu::class, 2)->make($Type));
                    }));
            });
        }
    }
618018
public function run()
    {
        $template = $this->twig->load('cloudbuild.yaml.tmpl');
        $context = [
            'cloud_sql_instances' => $this->cloudSqlInstances,
            'cloud_sql_proxy_image' => self::CLOUD_SQL_PROXY_IMAGE,
            'target_image' => $this->image,
            'commands' => implode(
                ',',
                array_map('escapeshellarg', $this->commands)
            )
        ];
        $cloudBuildYaml = $template->render($context);
        file_put_contents("$this->workdir/cloudbuild.yaml", $cloudBuildYaml);
        list($result, $cmdOutput) = $this->gcloud->exec(
            [
                'container',
                'builds',
                'submit',
                "--config=$this->workdir/cloudbuild.yaml",
                "$this->workdir"
            ]
        );
        file_put_contents(
            "$this->workdir/cloudbuild.log",
            implode(PHP_EOL, $cmdOutput)
        );
        if ($result !== 0) {
            throw new \RuntimeException("Failed to run the command");
        }
        $ret = '';
        if ($this->cloudSqlInstances) {
            $targetStep = 'Step #3';
        } else {
            $targetStep = 'Step #1';
        }
        foreach ($cmdOutput as $line) {
            if (\strpos($line, $targetStep) !== false) {
                $ret .= $line . PHP_EOL;
            }
        }
        return $ret;
    }
1084050
def _run_sbgenomics(args):
    
    assert not args.no_container, "Seven Bridges runs require containers"
    main_file, json_file, project_name = _get_main_and_json(args.directory)
    flags = []
    cmd = ["sbg-cwl-runner"] + flags + args.toolargs + [main_file, json_file]
    _run_tool(cmd)
304668
def run(self, **options):
        """"""
        if not self.is_setup:
            self.setup()

        if self.twisted:
            self.run_with_twisted(**options)
        elif self.gunicorn:
            self.run_with_gunicorn(**options)
        else:
            self.run_with_werkzeug(**options)
208381
def run(self):
        """"""
        # Launch the broker(s)
        for hostname, nb_brokers in self.broker_hosts:
            for ind in range(nb_brokers):
                if self.externalHostname in utils.localHostnames:
                    self.brokers.append(localBroker(
                        debug=self.debug,
                        nice=self.nice,
                        backend=self.backend,
                    ))
                else:
                    self.brokers.append(remoteBroker(
                        hostname=hostname,
                        pythonExecutable=self.python_executable,
                        debug=self.debug,
                        nice=self.nice,
                        backend=self.backend,
                        rsh=self.rsh,
                        ssh_executable=self.ssh_executable,
                    ))

        # Share connection information between brokers
        if self.b > 1:
            for broker in self.brokers:
                # Only send data of other brokers to a given broker
                connect_data = [
                    BrokerInfo(
                        x.getHost(),
                        *x.getPorts(),
                        externalHostname=x.getHost()
                    )
                    for x in self.brokers
                    if x is not broker
                ]
                broker.sendConnect(connect_data)

        # Launch the workers
        shells = []
        origin_launched = False
        for hostname, nb_workers in self.worker_hosts:
            self.workers.append(self.LAUNCH_HOST_CLASS(hostname, self.rsh,
                                                       self.ssh_executable))
            total_workers_host = min(nb_workers, self.workersLeft)

            self.setWorkerInfo(hostname, total_workers_host, not origin_launched)
            origin_launched = True
            self.workersLeft -= total_workers_host

            # Launch every workers at the same time
            scoop.logger.debug(
                "{0}: Launching '{1}'".format(
                    hostname,
                    self.workers[-1].getCommand(),
                )
            )
            shells.append(self.workers[-1].launch(
                (self.brokers[0].brokerPort,
                 self.brokers[0].infoPort)
                    if self.tunnel else None,
            ))
            if self.workersLeft <= 0:
                # We've launched every worker we needed, so let's exit the loop
                break
        rootProcess = shells[0][0]

        # Wait for the root program
        try:
            if self.workers[0].isLocal():
                self.errors = self.workers[0].subprocesses[0].wait()
            else:
                self.errors = rootProcess.wait()
        except KeyboardInterrupt:
            pass
        scoop.logger.info('Root process is done.')
        return self.errors
1313177
public function run()
	{
		$context = $this->getContext();
		$serviceManager = \Aimeos\MShop::create( $context, 'service' );

		$search = $serviceManager->createSearch();
		$start = 0;

		do
		{
			$serviceItems = $serviceManager->searchItems( $search );

			foreach( $serviceItems as $serviceItem )
			{
				try
				{
					$serviceManager->getProvider( $serviceItem, $serviceItem->getType() )->updateAsync();
				}
				catch( \Exception $e )
				{
					$msg = 'Executing updateAsyc() of "%1$s" failed: %2$s';
					$context->getLogger()->log( sprintf( $msg, $serviceItem->getProvider(), $e->getMessage() ) );
				}
			}

			$count = count( $serviceItems );
			$start += $count;
			$search->setSlice( $start );
		}
		while( $count >= $search->getSliceSize() );
	}
1297147
function _run() {
    _verifyCWD();

    var customStartupFilePath = path.resolve(process.cwd() + '/bin/www');

    if (fs.existsSync(customStartupFilePath)) {
        require(customStartupFilePath);
    } else if (fs.existsSync(PROJECT_INDEX)) {
        let service = require(PROJECT_INDEX);
        if (!(service instanceof Service)) {
            utils._stderr(`${PROJECT_INDEX} does not export a Service object`);
            process.exit(1);
        }

        service.listen();
    }
}