Get the directory where a job will work.

@param Job $job The job
@return string
480633
protected function _getJobDirectory(Job $job)
    {
        $jobDir = $this->getDirectory() . DIRECTORY_SEPARATOR . $job->getId();
        $this->_prepareDirectory($jobDir);

        return $jobDir;
    }
1194351
public function getJobInputMediaAssets($job)
    {
        $jobId = Utilities::getEntityId(
            $job,
            'WindowsAzure\MediaServices\Models\Job'
        );

        $propertyList = $this->_getEntityList("Jobs('{$jobId}')/InputMediaAssets");
        $result = [];

        foreach ($propertyList as $properties) {
            $result[] = Asset::createFromOptions($properties);
        }

        return $result;
    }
458246
protected function findJobHandler(Job $job)
    {
        foreach ($this->handlers as $type => $handler) {
            if ($job->getHandlerType() == $type) {
                return $handler;
            }
        }
        
        throw new \OutOfBoundsException(\sprintf('Job handler "%s" not found for job %s', $job->getHandlerType(), $job->getId()));
    }
1205781
public function getRootDirectory()
    {
        $dir = $this->getWorktreeDirectory();
        $relativeRoot = trim(str_replace(DIRECTORY_SEPARATOR, '/', $this->gitRepository->getDirectoryToParse()), '/');
        if ($relativeRoot !== '') {
            $dir .= '/' . $relativeRoot;
        }

        return $dir;
    }
893780
protected function executeJob(Job $job)
    {
        $job->setStartDate($this->now);

        $command = 'php bin/console campaignchain:job '.$job->getId().' --env='.$this->getContainer()->get(
                'kernel'
            )->getEnvironment();
        $process = new Process($command);

        $this->logger->info('Executing Job with command: '.$command);
        $process->setTimeout($this->timeout);

        try {
            $process->mustRun();

            $this->logger->info('Process ID: '.$process->getPid());

            $job->setPid($process->getPid());
            $this->em->flush();
        } catch (ProcessFailedException $e) {
            $errMsg = 'Process failed: '.$e->getMessage();

            $this->logger->error($errMsg);
            $this->logger->info(self::LOGGER_MSG_END);

            $job->setPid($process->getPid());
            $job->setStatus(Job::STATUS_ERROR);
            $job->setMessage($errMsg);
            $this->em->flush();
        }
    }
94926
public function dispatch(JobInterface $job, $channel = QueueInterface::MAIN_CHANNEL)
    {
        $dispatched_job_id = $this->dispatcher->dispatch($job->setBatch($this), $channel);

        $this->dispatched_job_ids[] = $dispatched_job_id;

        return $dispatched_job_id;
    }
1245086
public function workingOn(Job $job)
    {
        $job->worker = $this;
        $this->currentJob = $job;
        $job->updateStatus(Status::STATUS_RUNNING);
        $data = json_encode(array(
            'queue' => $job->queue,
            'run_at' => strftime('%a %b %d %H:%M:%S %Z %Y'),
            'payload' => $job->payload
        ));
        Resque::redis()->set('worker:' . $job->worker, $data);
    }
590969
public function getDir($directory)
    {
        $directory = str_replace('/', DS, $directory);
        if (strpos($directory, $this->getBaseDir()) === false || !file_exists($directory)) {
            $directory = $this->getBaseDir() . DS . ltrim($directory, DS);
        }
        return $directory;
    }
899370
public function getJobTasks($job)
    {
        $jobId = Utilities::getEntityId(
            $job,
            'WindowsAzure\MediaServices\Models\Job'
        );

        $propertyList = $this->_getEntityList("Jobs('{$jobId}')/Tasks");
        $result = [];

        foreach ($propertyList as $properties) {
            $result[] = Task::createFromOptions($properties);
        }

        return $result;
    }
559283
public function view(User $user, Job $job)
    {
        return $this->allowOnTeam($user, $job->team_id);
    }
463876
public function bury(Job $job)
    {
        $this->pheanstalk->bury($job);

        $this->logJob($job->getId(), 'Job buried');
    }
11665
def get_output_dir(job_homedir=None):
    '''
    
    '''
    if job_homedir is not None:
        home_dir = job_homedir
    else:
        home_dir = environ.get('HOME')
    odir = os.path.join(home_dir, 'out')
    return odir
467769
public function transform(Job $job)
    {
        return [
            'createdAt' => $job->created_at->toW3cString(),
            'memberIds' => $job->members->pluck('id'),
            'memberName' => (count($job->members) > 0) ? $job->members->first()->user->name : null,
            'memberTagIds' => $job->member_tags->pluck('id'),
            'memberTagNames' => (count($job->member_tags) > 0)
                ? implode(', ', $job->member_tags->pluck('name')->toArray()) : null,
            'id' => $job->id,
            'locationId' => $job->location_id,
            'locationName' => is_null($job->location_id) ? null : $job->location->name,
            'start' => $job->start->toW3cString(),
            'updatedAt' => $job->updated_at->toW3cString(),
        ];
    }
1342625
protected function determineType($job)
    {
        switch (true) {
            case $job instanceof BroadcastEvent:
                return 'broadcast';
            case $job instanceof CallQueuedListener:
                return 'event';
            case $job instanceof SendQueuedMailable:
                return 'mail';
            case $job instanceof SendQueuedNotifications:
                return 'notification';
            default:
                return 'job';
        }
    }
818445
def job_path(cls, project, jobs):
        """"""
        return google.api_core.path_template.expand(
            "projects/{project}/jobs/{jobs}", project=project, jobs=jobs
        )
62499
protected function getJobsEarliestTryAt()
    {
        $tryAt = date('Y-m-d H:i:s');

        foreach ($this->jobs as $job) {
            if (!$job->isFinished() && Helper::datetimeLT($job->getTryAt(), $tryAt)) {
                $tryAt = $job->getTryAt();
            }
        }

        return $tryAt;
    }
1069453
public function getResult($jobname)
    {
        return isset($this->results[$jobname]) ? $this->results[$jobname] : null;
    }