Create and start up the internal workers.
336056
def build(self):
        """"""

        # If there's no output tube, it means that this stage
        # is at the end of a fork (hasn't been linked to any stage downstream).
        # Therefore, create one output tube.
        if not self._output_tubes:
            self._output_tubes.append(self._worker_class.getTubeClass()())

        self._worker_class.assemble(
            self._worker_args,
            self._input_tube,
            self._output_tubes,
            self._size,
            self._disable_result,
            self._do_stop_task,
            )

        # Build all downstream stages.
        for stage in self._next_stages:
            stage.build()
1236666
def _start(self, worker=None):
        """"""
        if worker:
            self._queue_workers.append(worker)

        if self._queue_workers and self._running_threads < self._max_threads:
            #print('Queue: {0} Running: {1} Workers: {2} '
            #       'Threads: {3}'.format(len(self._queue_workers),
            #                                 self._running_threads,
            #                                 len(self._workers),
            #                                 len(self._threads)))
            self._running_threads += 1
            worker = self._queue_workers.popleft()
            thread = QThread()
            if isinstance(worker, PythonWorker):
                worker.moveToThread(thread)
                worker.sig_finished.connect(thread.quit)
                thread.started.connect(worker._start)
                thread.start()
            elif isinstance(worker, ProcessWorker):
                thread.quit()
                worker._start()
            self._threads.append(thread)
        else:
            self._timer.start()

        if self._workers:
            for w in self._workers:
                if w.is_finished():
                    self._bag_collector.append(w)
                    self._workers.remove(w)

        if self._threads:
            for t in self._threads:
                if t.isFinished():
                    self._threads.remove(t)
                    self._running_threads -= 1

        if len(self._threads) == 0 and len(self._workers) == 0:
            self._timer.stop()
            self._timer_worker_delete.start()
567015
private synchronized Worker createWorker(int i) throws IOException {
    Preconditions.checkState(mState == State.STARTED,
        "Must be in a started state to create workers");
    File confDir = new File(mWorkDir, "conf-worker" + i);
    File logsDir = new File(mWorkDir, "logs-worker" + i);
    File ramdisk = new File(mWorkDir, "ramdisk" + i);
    logsDir.mkdirs();
    ramdisk.mkdirs();
    int rpcPort = getNewPort();
    int dataPort = getNewPort();
    int webPort = getNewPort();

    Map<PropertyKey, String> conf = new HashMap<>();
    conf.put(PropertyKey.LOGGER_TYPE, "WORKER_LOGGER");
    conf.put(PropertyKey.CONF_DIR, confDir.getAbsolutePath());
    conf.put(PropertyKey.Template.WORKER_TIERED_STORE_LEVEL_DIRS_PATH.format(0),
        ramdisk.getAbsolutePath());
    conf.put(PropertyKey.LOGS_DIR, logsDir.getAbsolutePath());
    conf.put(PropertyKey.WORKER_RPC_PORT, Integer.toString(rpcPort));
    conf.put(PropertyKey.WORKER_WEB_PORT, Integer.toString(webPort));

    Worker worker = mCloser.register(new Worker(logsDir, conf));
    mWorkers.add(worker);
    LOG.info("Created worker with (rpc, data, web) ports ({}, {}, {})", rpcPort, dataPort,
        webPort);
    return worker;
  }
111218
def _start_workers(self):
        
        # creating the pool of worker process or threads
        log.debug('%s starts a %s-pool of %s workers.' % \
                  (self, self.worker_type, self.worker_num))
        self.pool = []
        for host, worker_num in \
                           [(None, self.worker_num)] + list(self.worker_remote):
            for _worker in range(worker_num):
                __worker = Thread(target=_pool_worker, args=\
                                  (self._inqueue, self._outqueue, host)) \
                                  if self.worker_type == 'thread' else \
                           Process(target=_pool_worker, args=\
                                  (self._inqueue, self._outqueue, host))
                self.pool.append(__worker)
        for __worker in self.pool:
            __worker.daemon = True
            __worker.start()
        log.debug('%s started the pool' % self)
122702
def new_worker(self, name: str):
        """"""
        if not self.running:
            return self.immediate_worker
        worker = self._new_worker(name)
        self._start_worker(worker)
        return worker
36173
protected function startup()
    {
        $this->host->cleanup();
        $this->cleanup();
        $this->register();

        $cleaned = Job::cleanup($this->queues);
        if ($cleaned['zombie']) {
            $this->log('Failed <pop>'.$cleaned['zombie'].'</pop> zombie job'.($cleaned['zombie'] == 1 ? '' : 's'), Logger::NOTICE);
        }
        if ($cleaned['processed']) {
            $this->log('Cleared <pop>'.$cleaned['processed'].'</pop> processed job'.($cleaned['processed'] == 1 ? '' : 's'), Logger::NOTICE);
        }

        $this->setStatus(self::STATUS_RUNNING);

        Event::fire(Event::WORKER_STARTUP, $this);
    }
18850
private function startup()
	{
		$this->registerSigHandlers();
		$this->pruneDeadWorkers();
		Resque_Event::trigger('beforeFirstFork', $this);
		$this->registerWorker();
	}
317476
private void startWorkerIfNeeded() {
    // Perform a compare-and-swap retry loop for synchronization to make sure we don't start more
    // workers than desired.
    int currentCount = mPendingWorkers.get();
    while (currentCount < mMaxConcurrency) {
      int updatedCount = currentCount + 1;
      if (mPendingWorkers.compareAndSet(currentCount, updatedCount)) {
        // Start a new worker.
        FLog.v(TAG, "%s: starting worker %d of %d", mName, updatedCount, mMaxConcurrency);
        mExecutor.execute(mTaskRunner);
        break;
      }
      // else: compareAndSet failed due to race; snapshot the new count and try again
      FLog.v(TAG, "%s: race in startWorkerIfNeeded; retrying", mName);
      currentCount = mPendingWorkers.get();
    }
  }
729362
public function restart()
    {
        $workers = $this->ResqueStatus->getWorkers();

        $this->outputTitle('Restarting workers');

        if (!empty($workers)) {
            $this->stop();

            foreach ($workers as $worker) {
                if (isset($worker['type']) && $worker['type'] === 'scheduler') {
                    $this->startScheduler($worker);
                } else {
                    $this->start($worker);
                }
            }
        } else {
            $this->output->outputLine('No workers to restart', 'failure');
        }

        $this->output->outputLine();
    }
390559
def start(self):
        """"""
        for i in range(self.min):
            self._threads.append(WorkerThread(self.server))
        for worker in self._threads:
            worker.setName("CP Server " + worker.getName())
            worker.start()
        for worker in self._threads:
            while not worker.ready:
                time.sleep(.1)
815429
public function startup()
    {
        $this->pruneDeadWorkers();
        $this->registerWorker();
        $this->registerSigHandlers();
        $this->resqueInstance->events->trigger('beforeFirstFork', $this);
    }
465450
public void start() {
        if (hasRedissonInstance) {
            redisson = Redisson.create(config);
        }
        
        retrieveAddresses();
        
        if (config.getRedissonNodeInitializer() != null) {
            config.getRedissonNodeInitializer().onStartup(this);
        }
        
        int mapReduceWorkers = config.getMapReduceWorkers();
        if (mapReduceWorkers != -1) {
            if (mapReduceWorkers == 0) {
                mapReduceWorkers = Runtime.getRuntime().availableProcessors();
            }
            redisson.getExecutorService(RExecutorService.MAPREDUCE_NAME).registerWorkers(mapReduceWorkers);
            log.info("{} map reduce worker(s) registered", mapReduceWorkers);
        }
        
        for (Entry<String, Integer> entry : config.getExecutorServiceWorkers().entrySet()) {
            String name = entry.getKey();
            int workers = entry.getValue();
            redisson.getExecutorService(name).registerWorkers(workers);
            log.info("{} worker(s) for '{}' ExecutorService registered", workers, name);
        }

        log.info("Redisson node started!");
    }
1050000
def _initialize_processes(self, target, num_workers, description):
        # type: (_MultiprocessOffload, function, int, str) -> None
        
        if num_workers is None or num_workers < 1:
            raise ValueError('invalid num_workers: {}'.format(num_workers))
        logger.debug('initializing {}{} processes'.format(
            num_workers, ' ' + description if not None else ''))
        for _ in range(num_workers):
            proc = multiprocessing.Process(target=target)
            proc.start()
            self._procs.append(proc)
549864
public function startup()
    {
        $reflector = new ReflectionClass('Resque');
        $this->_resqueLibrary = dirname(dirname($reflector->getFileName()));

        $reflector = new ReflectionClass('ResqueScheduler\ResqueScheduler');
        $this->_resqueSchedulerLibrary = dirname(dirname(dirname($reflector->getFileName())));

        $this->ResqueStatus = new ResqueStatus(Resque::redis());

        $this->_io->styles('success', ['text' => 'green']);
        $this->_io->styles('bold', ['bold' => true]);
    }
571682
private function startup()
    {
        $this->registerSigHandlers();
        $this->pruneDeadWorkers();
        Event::trigger('beforeFirstFork', $this);
        $this->registerWorker();
    }
402855
public synchronized void start() throws IOException {
    Preconditions.checkState(mProcess == null, "Worker is already running");
    mProcess = new ExternalProcess(mProperties, LimitedLifeWorkerProcess.class,
        new File(mLogsDir, "worker.out"));
    mProcess.start();
  }
940441
def createWorkers(self, num_workers):
        
        for i in range(num_workers):
            self.workers.append(WorkerThread(self._requests_queue))