Processes one job iteration
@param array $job
@return array
195630
public function process(array $job)
    {
        $this->hook->attach('job.process.before', $job, $this);

        if (empty($job['status'])) {
            return $this->getResult($job, array('finish' => true));
        }

        $progress = 0;
        $start_time = microtime(true);

        while (round((microtime(true) - $start_time) * 1000, 2) < self::LIMIT) {

            $this->processIteration($job);

            if (empty($job['status'])) {
                break;
            }

            $progress = round($job['done'] * 100 / $job['total']);

            if ($job['done'] < $job['total']) {
                continue;
            }

            $job['status'] = false;
            break;
        }

        $result = array(
            'progress' => $progress,
            'done' => $job['done'],
            'errors' => $job['errors'],
            'finish' => empty($job['status']),
            'message' => $job['message']['process']
        );

        $response = $this->getResult($job, $result);

        $this->hook->attach('job.process.after', $job, $result, $response, $this);
        return $response;
    }
1315085
public function process( $connection, Job $job, $maxTries = 0, $delay = 0 )
	{
		if ( $maxTries > 0 && $job->attempts() > $maxTries )
			return $this->logFailedJob( $connection, $job );

		try
		{
			$this->raiseBeforeJobEvent( $connection, $job );

			// First we will fire off the job. Once it is done we will see if it will be
			// automatically deleted after processing and if so we'll fire the delete
			// method on the job. Otherwise, we will just keep on running our jobs.
			$job->fire();

			$this->raiseAfterJobEvent( $connection, $job );

			return ['job' => $job, 'failed' => false];
		}
		catch ( Exception $e )
		{
			$this->handleJobException( $connection, $job, $delay, $e );
		}
		catch ( Throwable $e )
		{
			$this->handleJobException( $connection, $job, $delay, $e );
		}

		return null;
	}
743168
protected function processRecord(array $record): array
    {
        if ($this->processors) {
            foreach ($this->processors as $processor) {
                $record = PhpHelper::call($processor, $record);
            }
        }

        return $record;
    }
1198382
protected function processRecord(array $record): array
    {
        foreach ($this->processors as $processor) {
            $record = $processor($record);
        }

        return $record;
    }
748865
public function getJobStatus($job)
    {
        $jobId = Utilities::getEntityId(
            $job,
            'WindowsAzure\MediaServices\Models\Job'
        );
        $jobIdEncoded = urlencode($jobId);

        $method = Resources::HTTP_GET;
        $headers = [];
        $postParams = [];
        $queryParams = [];
        $path = "Jobs('{$jobIdEncoded}')/State";
        $statusCode = Resources::STATUS_OK;

        $response = $this->sendHttp(
            $method,
            $headers,
            $queryParams,
            $postParams,
            $path,
            $statusCode
        );

        return strip_tags($response->getBody());
    }
1256236
public function process(JobInterface $job, $maxTries = 0, $delay = 0)
    {
        if ($maxTries > 0 && $job->attempts() > $maxTries) {
            $this->fail($job);
            return Result::failed($job);
        }

        try {
            $job->fire();
            return Result::success($job);
        } catch (Exception $e) {
            // If we catch an exception, we will attempt to release the job back onto
            // the queue so it is not lost. This will let is be retried at a later
            // time by another listener (or the same one). We will do that here.
            if (!$job->isDeleted()) {
                $job->release($delay);
            }
            throw $e;
        } // @codeCoverageIgnoreStart
        catch (Throwable $e) {
            if (!$job->isDeleted()) {
                $job->release($delay);
            }
            throw $e;
        }
        // @codeCoverageIgnoreEnd
    }
279594
public function process($connection, Job $job, $maxTries = 0, $delay = 0)
    {
        $startTime = microtime(true);
        $result = null;

        try {
            $result = parent::process($connection, $job, $maxTries, $delay);
        } catch (Exception $e) {
            $this->recordJobException($e);
        } catch (Throwable $e) {
            $this->recordJobException($e);
        } finally {
            $this->recordJobEnd($startTime, $job->resolveName());
            return $result;
        }
    }
168803
public function perform(Resque_Job $job)
    {
        $startTime = microtime(true);
        try {
            Resque_Event::trigger('afterFork', $job);
            $job->perform();
            $this->log(array('message' => 'done ID:' . $job->payload['id'], 'data' => array('type' => 'done', 'job_id' => $job->payload['id'], 'time' => round(microtime(true) - $startTime, 3) * 1000)), self::LOG_TYPE_INFO);
        } catch (Exception $e) {
            $this->log(array('message' => $job . ' failed: ' . $e->getMessage(), 'data' => array('type' => 'fail', 'log' => $e->getMessage(), 'job_id' => $job->payload['id'], 'time' => round(microtime(true) - $startTime, 3) * 1000)), self::LOG_TYPE_ERROR);
            $job->fail($e);
            return;
        }

        $job->updateStatus(Resque_Job_Status::STATUS_COMPLETE);
    }
412606
protected function retryJob($job)
    {
        $this->laravel['queue']->connection($job->connection)->pushRaw(
            $this->resetAttempts($job->payload), $job->queue
        );
    }
751775
protected function runJob($job, $connection, $maxTries, $delay)
    {
        try {
            return $this->process($connection, $job, $maxTries, $delay);
        }
        catch (Exception $e) {
            $this->handleException($e);
        }
        catch (Throwable $e) {
            $this->handleException(new FatalThrowableError($e));
        }
    }
306809
public function serialize(Job $job)
    {
        $attributes = $job->getAttributes();
        $attributes['className'] = get_class($job);
        $attributes['type'] = $job->getType();
        return $attributes;
    }
301911
public static function fromJob($job)
    {
        if ($tags = static::extractExplicitTags($job)) {
            return $tags;
        }

        return static::modelsFor(static::targetsFor($job))->map(function ($model) {
            return FormatModel::given($model);
        })->all();
    }
1194599
public function processing(JobInterface $job)
    {
        $this->checkConnected();
        return $this->client->working($job->getId());
    }
550986
public function process(Job $job, ListenerOptions $options)
    {
        $this->log('[' . get_class($this) . '] MessageId=' . $job->getId() . ', Payload=' . $job->getPayload());

        $res = $this->handle($job, $options);

        $this->log('[' . get_class($this) . '] MessageId=' . $job->getId() . ', Result=' . serialize($res));

        // delete handled job if successfully handled
        if ($res !== false && !$job->isDeleted()) {
            $job->delete();
        }

        return $res;
    }
225781
protected function createObjectPayload($job)
    {
        return [
            'displayName' => $this->getDisplayName($job),
            'job' => 'Zilf\Queue\CallQueuedHandler@call',
            'maxTries' => $job->tries ?? null,
            'timeout' => $job->timeout ?? null,
            'timeoutAt' => $this->getJobExpiration($job),
            'data' => [
                'commandName' => get_class($job),
                'command' => serialize(clone $job),
            ],
        ];
    }
440083
protected function calculateRootJobStatus(array $jobs)
    {
        $new = 0;
        $running = 0;
        $cancelled = 0;
        $failed = 0;
        $success = 0;

        foreach ($jobs as $job) {
            switch ($job->getStatus()) {
                case Job::STATUS_NEW:
                    $new++;
                    break;
                case Job::STATUS_RUNNING:
                    $running++;
                    break;
                case Job::STATUS_CANCELLED:
                    $cancelled++;
                    break;
                case Job::STATUS_FAILED:
                    $failed++;
                    break;
                case Job::STATUS_SUCCESS:
                    $success++;
                    break;
                default:
                    throw new \LogicException(sprintf(
                        'Got unsupported job status: id: "%s" status: "%s"',
                        $job->getId(),
                        $job->getStatus()
                    ));
            }
        }

        return $this->getRootJobStatus($new, $running, $cancelled, $failed, $success);
    }
508529
protected function markJobAsReserved($job)
	{
		$job->reserved = 1;
		$job->attempts = $job->attempts + 1;
		$job->reserved_at = $this->getTime();

		$this->database->table($this->table)->where('id', $job->id)->update([
			'reserved' => $job->reserved,
			'reserved_at' => $job->reserved_at,
			'attempts' => $job->attempts,
		]);

		return $job;
	}