Update node counters indicating how many jobs the node has produced

@param array $jobs Jobs
555494
protected function updateNodeStats(array $jobs)
    {
        foreach ($jobs as $job) {
            $jobId = $job[JobsResponse::KEY_ID];
            $nodeId = $this->getNodeIdFromJobId($jobId);
            if (!isset($nodeId) || !isset($this->nodes[$nodeId])) {
                continue;
            }

            $node = $this->nodes[$nodeId];
            $node->addJobCount(1);
        }
    }
1325672
public function addJob(\CampaignChain\CoreBundle\Entity\Job $jobs)
    {
        $this->jobs[] = $jobs;

        return $this;
    }
812197
public function startProcessing(\ArrayObject $jobs)
    {
        foreach ($jobs as $job) {
            $job->setStatus(JobInterface::STATUS_PROCESSING);
            $job->setDateLastRun($this->date);
            $job->save();
        }

        return $this;
    }
707413
public void updateMetrics() {
    Counters counters = getCounters();
    for (Counters.Group group : counters) {
      jobMetrics.setTag("group", group.getDisplayName());
      for (Counters.Counter counter : group) {
        jobMetrics.setTag("counter", counter.getDisplayName());
        jobMetrics.setMetric("value", (float) counter.getCounter());
        jobMetrics.update();
      }
    }
  }
1005918
public function commit() {
        if(empty($this->NodeCounts)) {
            $this->Logger->debug(__FUNCTION__ .'-> No nodes to change counts on.');
            return;
        }

        foreach($this->NodeCounts as $nodeRefUrl => $count) {
            $nodeRef = $this->NodeRefService->parseFromString($nodeRefUrl);

            // incrementMeta can handle negative values, so no need to call decrementMeta here
            if($count != 0) {
                $this->Logger->debug(__FUNCTION__ ."-> Updating ".$this->getMetaID()." by {$count} for: $nodeRefUrl");
                $this->NodeService->incrementMeta($nodeRef, $this->getMetaID(), $count);
            }
            else
                $this->Logger->debug(__FUNCTION__ ."-> No update of ".$this->getMetaID()." for: $nodeRefUrl");
        }

        $this->NodeCounts = array();
    }
320436
private function addTasks($tasks = null)
    {
        //====================================================================//
        // No tasks to Add
        if (is_null($tasks) && empty($this->tasks)) {
            return true;
        }

        //====================================================================//
        // Prepare Tasks To Perform
        //====================================================================//

        //====================================================================//
        // Add Internal Tasks to buffer
        if (!empty($this->tasks)) {
            $this->outputs->tasks = $this->tasks;
            $this->outputs->taskscount = count($this->outputs->tasks);
            Splash::log()->deb('[WS] Call Loaded '.$this->outputs->tasks->count().' Internal tasks');
        } else {
            $this->outputs->tasks = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);
        }

        //====================================================================//
        // Add External Tasks to the request
        if (!empty($tasks)) {
            $this->outputs->tasks->append($tasks);
            $this->outputs->taskscount = count($tasks);
            Splash::log()->deb('[WS] Call Loaded '.count($tasks).' External tasks');
        }

        return true;
    }
39579
public function getFinishedJobs()
    {
        while (count($this->jobs) !== 0) {
            foreach ($this->jobs as $index => $job) {
                if ($job->isFinished()) {
                    unset($this->jobs[$index]);
                    yield $index => $job;
                }
            }
        }
    }
526235
private function watchForChanges(OutputInterface $output, array $files)
    {
        $output->writeln("Watching for changes");

        $previously = [];
        while (true) {
            foreach ($files as $file) {
                /** @var SplFileInfo $file */
                if ($this->checkFile($file->getRealPath(), $previously)) {
                    $output->writeln(
                        sprintf(
                            "<info>>>>></info> <comment>The following file changed:</comment> <info>%s</info>",
                            $file->getPathname()
                        )
                    );

                    $this->getJobs();
                    $this->registry->addJob($this->registry->getNewJob());

                    return;
                }
            }
            sleep(1);
        }

        return;
    }
1344819
private function pushSchedule($job)
    {
        $runTime = $job->getRunTime($this->currTime);

        if (array_key_exists($runTime, $this->schedule)) {
            $this->schedule = [$runTime => $job];
        } else {
            $this->schedule[$runTime][] = $job;
        }
    }
657860
public function sync($jobs)
    {
        $updates = 0;

        foreach ($jobs as $job) {

            $args = $job->arguments();

            if (!isset($args[0]) || !is_scalar($args[0]) || !isset($this->tasks[$args[0]])) {
                continue;
            }

            $task = $this->tasks[$args[0]];

            $task->state = $job->state();
            $updates++;
        }

        return $updates;
    }
257068
public function updateStatus(Job $job, int $status): void
    {
        $id = sprintf('job:%s:status', $job->getId());
        $packet = [
            'status' => $status,
            'updated' => time(),
        ];

        $this->client->set($id, json_encode($packet));

        if (in_array($status, JobManager::COMPLETED_STATUSES, false)) {
            $this->client->expire($id, 86400);
        }
    }
770958
public function trackUsedPrefixes( $prefixes )  {
		if ( !is_array( $prefixes ) ) {
			$prefixes = $this->matchPrefixes( $prefixes );
		}

		$this->usedPrefixes = array_merge( $this->usedPrefixes, $prefixes );
	}
765934
public function update($class, array $counts)
    {
        if (! isset($this->coverage[$class])) {
            $this->coverage[$class] = $counts;

            return;
        }

        foreach ($counts as $line => $status) {
            if (! isset($this->coverage[$class][$line]) || $status > 0) {
                // converts "hits" to "status"
                $status = ! $status ? -1 : ($status > 1 ? 1 : $status);

                $this->coverage[$class][$line] = $status;
            }
        }
    }
35542
public function bulk($jobs, $data = '', $queue = null)
    {
        foreach ((array) $jobs as $job) {
            $this->push($job, $data, $queue);
        }
    }
544753
public function onConcurrentRunnerEnd($errors)
    {
        $this->output->writeln(sprintf(' Run time: %s', \PHP_Timer::secondsToTimeString($this->getTime())));
        $errorCount = count($errors);
        if (! $errorCount) {
            return;
        }

        $labels = ['was', 'error'];

        if ($errorCount > 1) {
            $labels = ['were', 'errors'];
        }

        $this->output->writeln('');
        $this->output->writeln($this->color('error', sprintf('There %s %d %s:', $labels[0], $errorCount, $labels[1])));
        $this->outputErrors($errors);
    }
433894
protected function _count($items)
    {
        foreach ($items as $item) {
            $this->_count++;
            $item = is_array($item) ? new Entity($item) : $item;

            if ($item->has('children') && !empty($item->children) && $item->expanded) {
                $this->_count($item->children);
            }
        }
    }
76853
private function pushExecutedJob(Job $job)
    {
        $this->executed_jobs[] = $job;
        $command = $job->getCommand();
        $args = $job->getArguments();
        // If callable, log the string Closure
        if (is_callable($command)) {
            $command = \is_string($command) ? $command : 'Closure';
        }
        $this->addSchedulerVerboseOutput("<green>Success</green>: <white>{$command} {$args}</white>");

        return $job;
    }