Checks that the job received is actually from PHPCI, and has a valid type.
@param Job $job
@param $jobData
@return bool
494561
protected function verifyJob(Job $job, $jobData)
    {
        if (empty($jobData) || !is_array($jobData)) {
            // Probably not from PHPCI.
            $this->pheanstalk->delete($job);
            return false;
        }

        if (!array_key_exists('type', $jobData) || $jobData['type'] !== 'phpci.build') {
            // Probably not from PHPCI.
            $this->pheanstalk->delete($job);
            return false;
        }

        return true;
    }
855373
private function hasNotStartedChild(Job $job)
    {
        foreach ($job->getChildJobs() as $childJob) {
            if (Job::STATUS_NEW === $childJob->getStatus()) {
                return true;
            }
        }

        return false;
    }
874471
public function isRunning(Job $job) {
        $runner = $this->getJobRunner($job);

        return $runner->isRunning($job);
    }
655076
protected function executeJob(Job $job): ?\Throwable
    {
        try {
            $this->jobExecutor->executeJob($job, $this->retryLimit);
        } catch (\Throwable $e) {
            return $e;
        }

        return null;
    }
977745
protected function createObjectPayload($job, $data)
    {
        $commandName = get_class($job);

        $command = serialize(clone $job);

        return array(
            'job'  => 'Nova\Queue\CallQueuedHandler@call',

            'data' => compact('commandName', 'command'),
        );
    }
927744
public function retry(AbstractJob $job)
    {
        if ($job->shouldRetry()) {
            return $this->addJobToRetrySet($job, $job->getRetryTime());
        }

        return false;
    }
1129326
public function delete(Job $job)
    {
        $result = false;
        try {
            $res = $this->_queue->deleteMessage($job->getInstance()->getReceiptHandle());
            $result = $res->isSucceed();
        } catch (\Exception $e) {
            $this->eventsManager->fire('listener:logger', $this, '删除Queue消息失败:' . $e->getMessage());
        } finally {
            return $result;
        }
    }
931637
public function delete(Job $job)
    {
        $this->pheanstalk->delete($job);

        $this->logJob($job->getId(), 'Job deleted');
    }
1301191
public function workingOn(Job &$job)
    {
        $this->job = $job;
        $job->setWorker($this);

        Event::fire(Event::WORKER_WORKING_ON, array($this, $job));

        $this->redis->hmset(self::redisKey($this), array(
            'job_id'      => $job->getId(),
            'job_started' => microtime(true)
        ));
    }
952097
protected function createJobInstance($job)
    {
        if ($job instanceof JobInterface) {
            return $job;
        }

        // Create callable
        if (is_callable($job)) {
            $job = new CallableJob($job, md5(uniqid('', true)));
        }

        // Create by class name.
        if (is_string($job)) {
            if (!class_exists($job) || is_subclass_of($job, JobInterface::class)) {
                throw new \InvalidArgumentException(
                    sprintf('Job should be a class which implements JobInterface, %s given', $job)
                );
            }

            $handler = $this->newInstanceHandler;

            $job = $handler($job);

            if (!$job instanceof JobInterface) {
                throw new \UnexpectedValueException('Job instance is not a JobInterface.');
            }
        }

        if (is_array($job)) {
            throw new \InvalidArgumentException('Job should not be array.');
        }

        return $job;
    }
83691
public function call(Job $job, array $data)
    {
        $payload = $this->crypt->decrypt(
            $data['closure']
        );

        $closure = unserialize($payload);

        call_user_func($closure, $job);
    }
34169
public function save(AbstractJob $job)
    {

        $data = $job->getData();
        if (!$job->isStored()) {
            $job->setId(uniqid());
        }

        $this->redis->set($this->namespace . $job->getId(), json_encode($data));

        return true;
    }
480633
protected function _getJobDirectory(Job $job)
    {
        $jobDir = $this->getDirectory() . DIRECTORY_SEPARATOR . $job->getId();
        $this->_prepareDirectory($jobDir);

        return $jobDir;
    }
748074
public function delete( $job ) {
		$where = array(
			'id' => $job->id(),
		);

		if ( $this->database->delete( $this->jobs_table, $where ) ) {
			return true;
		}

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

        $method = Resources::HTTP_GET;
        $headers = [];
        $postParams = [];
        $queryParams = [];
        $path = "CancelJob?jobid='{$jobIdEncoded}'";
        $statusCode = Resources::STATUS_NO_CONTENT;

        $this->sendHttp(
            $method,
            $headers,
            $queryParams,
            $postParams,
            $path,
            $statusCode
        );
    }
910473
public function add(Job $job)
    {
        $jobClass = new \ReflectionClass($job);
        $name = $jobClass->getName();
        $object = serialize($job);
        $jobId = $this->broker->put(['object' => $object, 'class' => $name]);
        $this->broker->setStatus($jobId,
            ['status' => Job::STATUS_QUEUED, 'queued'=> date(DATE_RFC3339_EXTENDED)]
        );
        return $jobId;
    }
1139468
protected function addCallbackJob($type, $job)
    {
        if (is_object($job) && $job instanceof self) {
            $this->data[self::P_CALLBACKS][$type][] = serialize($job);
            $this->callbacks[$type][] = $job;

            return $this;
        }

        if (is_string($job)) {
            $this->data[self::P_CALLBACKS][$type][] = $job;
            $this->callbacks[$type][] = unserialize($job);

            return $this;
        }

        throw new JobException('Callback job must be a serialized string OR object!');
    }