protected function makeJob($parentRunId = null, $isV2 = false) { /** @var Encryptor $encryptor */ $encryptor = $this->httpClient->getContainer()->get('syrup.encryptor'); /** @var ObjectEncryptor $objectEncryptor */ $objectEncryptor = $this->httpClient->getContainer()->get('syrup.object_encryptor'); // create job $tokenData = $this->storageApiClient->verifyToken(); $componentName = 'queue'; $jobId = $this->storageApiClient->generateId(); $job = new Job($objectEncryptor); $job->setId($jobId); $job->setRunId(is_null($parentRunId) ? $this->storageApiClient->generateId() : $parentRunId . '.' . $this->storageApiClient->generateId()); $job->setCommand('run'); $job->setComponent($componentName); $job->setLockName('syrup-queue-test'); if ($parentRunId) { $job->setLockName($job->getLockName() . '-child'); } $job->setToken(['id' => $tokenData['id'], 'description' => $tokenData['description'], 'token' => $encryptor->encrypt($this->storageApiClient->getTokenString())]); $job->setStatus(Job::STATUS_WAITING); $job->setCreatedTime(date('c')); $job->setProject(['id' => $tokenData['owner']['id'], 'name' => $tokenData['owner']['name']]); if ($isV2) { $job->setAttribute('protocol', 'v2'); } return $job; }