Create a new job

@param array  $job     Array of attributes to use when creating the job
@param array  $params  Optional overrides

@return Services_Zencoder_Job The object representation of the resource
979995
public function create($job = NULL, $params = array()) {
    if(is_string($job)) {
      $json = trim($job);
    } else if(is_array($job)) {
      $json = json_encode($job);
    } else {
      throw new Services_Zencoder_Exception(
        'Job parameters required to create job.');
    }
    $request = $this->proxy->createData("jobs", $json, $params);
    if ($request) {
      return new Services_Zencoder_Job($request);
    }
    throw new Services_Zencoder_Exception('Unable to create job');
  }
198897
public function encode($source, $preset)
    {
        // Tell the Zencoder SDK to create a job
        try {
            $outputs = $this->outputsConfig($preset);
            $job = $this->sdk()->jobs->create([
                'input' => $source,
                'output' => $outputs,
            ]);

            // Store the response from the SDK
            $this->model->storeJob($job->id, $this->outputsToHash($job->outputs));

        // Report an error with the encode
        } catch (Services_Zencoder_Exception $e) {
            $this->model->status('error', implode(' ', $this->zencoderArray($e->getErrors())));
        } catch (Exception $e) {
            $this->model->status('error', $e->getMessage());
        }
    }
134138
function(args, options, callback) {
            // Get the query and parameters, and remove the extraneous
            // search parameter
            var query = options.search;
            var params = options;
            delete params.search;

            // Create the job
            this.service.jobs().create(query, params, function(err, job) {
                if (err) {
                    callback(err);
                    return;
                }
                
                console.log("Created job " + job.sid);
                callback(null, job);
            });
        }
714790
protected function markJobAsReserved($job)
    {
        $this->database->createCommand()->update(
            $this->table, [
            'reserved_at' => $job->touch(),
            'attempts' => $job->increment(),
            ], [
            'id' => $job->id
            ]
        )->execute();

        return $job;
    }
1024733
public function createJob($serverId, array $data, $wait = true)
    {
        $job = $this->post("servers/$serverId/jobs", $data)['job'];

        if ($wait) {
            return $this->retry($this->getTimeout(), function () use ($serverId, $job) {
                $job = $this->job($serverId, $job['id']);

                return $job->status == 'installed' ? $job : null;
            });
        }

        return new Job($job + ['server_id' => $serverId], $this);
    }
1043085
protected function markJobAsReserved($job)
    {
        $this->db->name($this->table)->where('id', $job->id)->update([
            'reserved_at' => $job->reserved_at = $this->currentTime(),
            'attempts'    => ++$job->attempts,
        ]);

        return $job;
    }
72948
protected function createPayload($job, $data = '', $queue = null)
	{
		if ($job instanceof Closure)
		{
			return json_encode($this->createClosurePayload($job, $data));
		}
		elseif (is_object($job))
		{
			return json_encode([
				'job' => 'Illuminate\Queue\CallQueuedHandler@call',
				'data' => ['command' => serialize(clone $job)],
			]);
		}

		return json_encode($this->createPlainPayload($job, $data));
	}
447042
public function put($job)
    {
        $job['id'] = $this->redis->incr("job_id_sequence");
        $this->redis->lpush("job_queue", serialize($job));
        return $job['id'];
    }
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),
            ],
        ];
    }
1060443
public function removeJob($job = '')
    {

        if ($job instanceof TaskReposity) {
            $job = $job->buildCommandWithExpression();
        }

        $refrector = new CronEntry();
        $job = $refrector->parse($job);

        $this->getManager()->removeJob($job);

        return $this;
    }
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'),
        );
    }
785294
def create_job(self):
        
        my_user_agent = None
        try:
            my_user_agent = pkg_resources.require('netort')[0].version
        except pkg_resources.DistributionNotFound:
            my_user_agent = 'DistributionNotFound'
        finally:
            headers = {
                "User-Agent": "Uploader/{uploader_ua}, {upward_ua}".format(
                    upward_ua=self.meta.get('user_agent', ''),
                    uploader_ua=my_user_agent
                )
            }
        req = requests.Request(
            'POST',
            "{api_address}{path}".format(
                api_address=self.api_address,
                path=self.create_job_path
            ),
            headers=headers
        )
        req.data = {
            'test_start': self.job.test_start
        }
        prepared_req = req.prepare()
        logger.debug('Prepared create_job request:\n%s', pretty_print(prepared_req))

        response = send_chunk(self.session, prepared_req)
        logger.debug('Luna create job status: %s', response.status_code)
        logger.debug('Answ data: %s', response.content)
        job_id = response.content.decode('utf-8') if isinstance(response.content, bytes) else response.content
        if not job_id:
            self.failed.set()
            raise ValueError('Luna returned answer without jobid: %s', response.content)
        else:
            logger.info('Luna job created: %s', job_id)
            return job_id
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();
    }
453693
public function job($job, $queue = null)
    {
        return $this->call(
            function () use ($job, $queue) {
                $job = is_string($job) ? resolve($job) : $job;

                if ($job instanceof ShouldQueue) {
                    dispatch($job)->onQueue($queue);
                } else {
                    dispatch_now($job);
                }
            }
        )->name(is_string($job) ? $job : get_class($job));
    }
565877
public function push($job, array $data = null, $queue = null)
    {
        if (false !== ($delay = \Resque::getConfig('default.jobs.delay', false))) {
            return $this->later($delay, $job, $data, $queue);
        }

        return Job::create($this->getQueue($queue), $job, $data);
    }
477269
public function createTask(JobInterface $job)
    {
        $className = $job->getTaskClassName();
        $task = new $className($this, $job->getParams());

        if (!$task instanceof TaskAbstract) {
            throw new \InvalidArgumentException('Task must be an instance of "Extlib\Cron\Task\TaskAbstract", given "%s".', get_class($task));
        }
        
        return $task;
    }
844424
protected function createPayload($job, $data = '', $queue = null)
    {
        if (is_object($job)) {
            $payload = json_encode([
                'job' => 'Globalis\PuppetSkilled\Queue\CallQueuedHandler@call',
                'data' => [
                    'commandName' => get_class($job),
                    'command' => serialize(clone $job),
                ],
            ]);
        } else {
            $payload = json_encode($this->createPlainPayload($job, $data));
        }

        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new InvalidArgumentException('Unable to create payload: '.json_last_error_msg());
        }

        return $payload;
    }