Help on all the available workers
540987
def _help_workers(self):
        
        help =  'Workbench Workers:'
        for worker in self.list_all_workers():
            full_help = self.work_request('help_formatter', worker)['help_formatter']['help']
            compact_help = full_help.split('\n')[:4]
            help += '\n\n%s' % '\n'.join(compact_help)
        return help
1356578
def adjust_worker_number_by_load(self):
        
        if self.interrupted:
            logger.debug("Trying to adjust worker number. Ignoring because we are stopping.")
            return

        to_del = []
        logger.debug("checking worker count."
                     " Currently: %d workers, min per module : %d, max per module : %d",
                     len(self.workers), self.min_workers, self.max_workers)

        # I want at least min_workers by module then if I can, I add worker for load balancing
        for mod in self.q_by_mod:
            # At least min_workers
            todo = max(0, self.min_workers - len(self.q_by_mod[mod]))
            for _ in range(todo):
                try:
                    self.create_and_launch_worker(module_name=mod)
                # Maybe this modules is not a true worker one.
                # if so, just delete if from q_by_mod
                except NotWorkerMod:
                    to_del.append(mod)
                    break

        for mod in to_del:
            logger.warning("The module %s is not a worker one, I remove it from the worker list.",
                           mod)
            del self.q_by_mod[mod]
971077
def _ensure_worker(self):
        """"""
        while len(self._workers) < self._min_workers or len(self._workers) < self._queue.qsize() < self._max_workers:
            worker = threading.Thread(
                target=self._execute_futures,
                name=self.identifier + '_%d' % time.time(),
            )
            worker.daemon = True
            self._workers.add(worker)
            worker.start()
1279777
def workers(self):
        
        if self._workers is None:
            self._workers = WorkerList(self._version, workspace_sid=self._solution['sid'], )
        return self._workers
489523
def stop_workers(self):
        """"""

        self._started = False

        for worker in self._workers:
            worker.stop()
1362522
def recover_all(lbn, profile='default'):
    '''
    
    '''

    ret = {}
    config = get_running(profile)
    try:
        workers_ = config['worker.{0}.balance_workers'.format(lbn)].split(',')
    except KeyError:
        return ret

    for worker in workers_:
        curr_state = worker_status(worker, profile)
        if curr_state['activation'] != 'ACT':
            worker_activate(worker, lbn, profile)
        if not curr_state['state'].startswith('OK'):
            worker_recover(worker, lbn, profile)
        ret[worker] = worker_status(worker, profile)

    return ret
276176
protected function job(): void
    {
        $mining_observers = $this->retrieve([
            'corporation_id' => $this->getCorporationId(),
        ]);

        if ($mining_observers->isCachedLoad()) return;

        collect($mining_observers)->each(function ($observer) {

            CorporationIndustryMiningObserver::firstOrNew([
                'corporation_id' => $this->getCorporationId(),
                'observer_id'    => $observer->observer_id,
            ])->fill([
                'last_updated'  => carbon($observer->last_updated),
                'observer_type' => $observer->observer_type,
            ])->save();
        });

        CorporationIndustryMiningObserver::where('corporation_id', $this->getCorporationId())
            ->whereNotIn('observer_id', collect($mining_observers)
                ->pluck('observer_id')->flatten()->all())
            ->delete();
    }
376126
protected function getWorkers() {
        if (!$this->_workers) {
            $this->_workers = new WorkerList($this->version, $this->solution['sid']);
        }

        return $this->_workers;
    }
576325
private function pull(): Worker
    {
        if (!$this->isRunning()) {
            throw new StatusError("The pool was shutdown");
        }

        do {
            if ($this->idleWorkers->isEmpty()) {
                if ($this->getWorkerCount() >= $this->maxSize) {
                    // All possible workers busy, so shift from head (will be pushed back onto tail below).
                    $worker = $this->busyQueue->shift();
                } else {
                    // Max worker count has not been reached, so create another worker.
                    $worker = $this->factory->create();
                    $this->workers->attach($worker, 0);
                    break;
                }
            } else {
                // Shift a worker off the idle queue.
                $worker = $this->idleWorkers->shift();
            }

            if ($worker->isRunning()) {
                break;
            }

            $this->workers->detach($worker);
        } while (true);

        $this->busyQueue->push($worker);
        $this->workers[$worker] += 1;

        return $worker;
    }
357414
def start(self):
        """"""
        if self.num_workers:
            self.queue = Queue(maxsize=self.num_workers)
            self.workers = [_Worker(self) for _ in range(self.num_workers)]
            for worker in self.workers:
                worker.start()
        self.running = True
511867
def run(self):
        
        from zengine.wf_daemon import run_workers, Worker

        worker_count = int(self.manager.args.workers or 1)
        if not self.manager.args.daemonize:
            print("Starting worker(s)")

        if worker_count > 1 or self.manager.args.autoreload:
            run_workers(worker_count,
                        self.manager.args.paths.split(' '),
                        self.manager.args.daemonize)
        else:
            worker = Worker()
            worker.run()
267312
def all_jobs(self):
        
        return list(set(self.complete + self.failed + self.queue + self.running))
709879
protected function spawnMinimumWorkers()
    {
        $this->logger->debug('verify that the minimum number ['.$this->min_children.'] of workers are running', [
            'category' => get_class($this),
        ]);

        for ($i = $this->count(); $i < $this->min_children; ++$i) {
            $this->spawnWorker();
        }
    }
1251291
private void startWorkers() {
        m_logger.info("Starting {} workers", m_config.workers);
        for (int workerNo = 1; workerNo <= m_config.workers; workerNo++) {
            LoadWorker loadWorker = new LoadWorker(workerNo);
            loadWorker.start();
            m_workerList.add(loadWorker);
        }
    }
1057491
def all(opts={})

      res = fetch_all(opts)

      res.is_a?(Array) ? res.map { |hwi| Ruote::Workitem.new(hwi) } : res
    end
485937
private function logAvailableHelpers()
    {
        $names = array_keys($this->helpers);
        $app = Strata::app();
        $app->setConfig("runtime.helpers", $names);
    }
969081
function dispatchWorkItems() {
	var i,
		workItem;
	if (!buffer.isEmpty()) {
		i = workerJobCount.indexOf(0);
		if(i >= 0) { //Free worker found
			workItem = buffer.next();

			// Send task to worker
			workerExec(i, workItem);

			//Check for more free workers
			dispatchWorkItems();
		}
	}
}