Accepts and serves the job description
490452
public void doDescription(StaplerRequest req, StaplerResponse rsp)
            throws IOException {
        if (req.getMethod().equals("GET")) {
            //read
            rsp.setContentType("text/plain;charset=UTF-8");
            rsp.getWriter().write(Util.fixNull(this.getDescription()));
            return;
        }
        if (req.getMethod().equals("POST")) {
            checkPermission(CONFIGURE);

            // submission
            if (req.getParameter("description") != null) {
                this.setDescription(req.getParameter("description"));
                rsp.sendError(SC_NO_CONTENT);
                return;
            }
        }

        // huh?
        rsp.sendError(SC_BAD_REQUEST);
    }
542172
function (jobName, jobConfig, customParams, callback) {
      [jobName, jobConfig, customParams, callback] = doArgs(arguments, ['string', 'string', ['object', {}], 'function']);

      // Set the created job name!
      customParams.name = jobName;

      const self = this;

      doRequest({
        method: 'POST',
        urlPattern: [JOB_CREATE],
        request: {
          body: jobConfig,
          headers: { 'Content-Type': 'application/xml' }
        },
        noparse: true
      }, customParams, function (error, data) {
        if (error) {
          callback(error, data);
          return;
        }
        self.job_info(jobName, customParams, callback);
      });
    }
1192741
def submit_job(self, job_config=None):
        
        job_id = self._delegator._submit_bundle(self, job_config)
        return self._instance.get_job(job_id)
777894
function serve(req, res) {
  var responseIsArray = Array.isArray(res.entityResponse);
  util.invariant(responseIsArray, 'Response values are required.');

  res.json({ values: res.entityResponse });
}
1183700
def submit(self, call, *args, **kwargs):
        
        future = StoredFuture(call, *args, **kwargs)
        self._queue.put(future)
        self._ensure_worker()
        return future
521309
@RequirePOST
    public void doSubmitDescription(StaplerRequest req, StaplerResponse rsp) throws IOException {
        checkPermission(Jenkins.ADMINISTER);

        description = req.getParameter("description");
        save();

        rsp.sendRedirect(".");  // go to the top page
    }
283574
def _exec_requested_job(self):
        """"""
        self._timer.stop()
        self._job(*self._args, **self._kwargs)
1245807
def accept_request(worker:, deferred:)
      if deferred.has_child?
        worker.push(deferred.child)
      else
        deferred.add_child_observer(worker)
      end
    end
1065217
function (jobName, customParams, callback) {
      [jobName, customParams, callback] = doArgs(arguments, ['string', ['object', {}], 'function']);

      doRequest({
        urlPattern: [JOB_INFO, jobName]
      }, customParams, callback);
    }
840233
protected function job(): void
    {
        $divisions = $this->retrieve([
            'corporation_id' => $this->getCorporationId(),
        ]);

        if ($divisions->isCachedLoad()) return;

        if (property_exists($divisions, 'hangar'))

            collect($divisions->hangar)->each(function ($hangar) {

                CorporationDivision::firstOrNew([
                    'corporation_id' => $this->getCorporationId(),
                    'type'           => 'hangar',
                    'division'       => $hangar->division,
                ])->fill([
                    'name' => $hangar->name ?? null,
                ])->save();
            });

        if (property_exists($divisions, 'wallet'))

            collect($divisions->wallet)->each(function ($wallet) {

                CorporationDivision::firstOrNew([
                    'corporation_id' => $this->getCorporationId(),
                    'type'           => 'wallet',
                    'division'       => $wallet->division,
                ])->fill([
                    'name' => $wallet->name ?? null,
                ])->save();
            });
    }
600401
def _job_handler(self) -> bool:
        """"""
        while True:
            try:
                task = self._unfullfilled.get_nowait()
            except queue.Empty:
                break
            else:
                self._log.debug("Job: %s" % str(task))
                engine = self._dyn_loader(task['engine'], task)
                task['start_time'] = now_time()
                results = engine.search()
                task['end_time'] = now_time()
                duration: str = str((task['end_time'] - task['start_time']).seconds)
                task['duration'] = duration
                task.update({'results': results})
                self._fulfilled.put(task)
        return True
1266870
protected function job(): void
    {
        // all items which need to be singleton

        // Get the assets for this character, chunked in a number of blocks
        // that the endpoint will accept.
        CorporationAsset::join('invTypes', 'type_id', '=', 'typeID')
            ->join('invGroups', 'invGroups.groupID', '=', 'invTypes.groupID')
            ->where('corporation_id', $this->getCorporationId())
            ->where('is_singleton', true)// only singleton items may have a specific location
            // it seems only items from that categories can have a specific location
            // 2  : Celestial
            // 6  : Ship
            // 22 : Deployable
            // 23 : Starbase
            // 65 : Structure
            ->whereIn('categoryID', [2, 6, 22, 23, 65])
            ->select('item_id')
            ->chunk($this->item_id_limit, function ($item_ids) {

                $this->request_body = $item_ids->pluck('item_id')->all();

                $locations = $this->retrieve([
                    'corporation_id' => $this->getCorporationId(),
                ]);

                collect($locations)->each(function ($location) {

                    $asset_data = CorporationAsset::where('corporation_id', $this->getCorporationId())
                        ->where('item_id', $location->item_id)
                        ->first();

                    // Location for items in either hangar or stations match to 0, 0, 0
                    $asset_data->fill([
                        'x'        => $location->position->x,
                        'y'        => $location->position->y,
                        'z'        => $location->position->z,
                        'map_id'   => 0,
                        'map_name' => '',
                    ]);

                    // If we have a non zero value for coordinates, attempt to identify a celestial.
                    if (($location->position->x + $location->position->y + $location->position->y) !== 0) {
                        $normalized_location = $this->find_nearest_celestial(
                            $asset_data->location_id,
                            $location->position->x, $location->position->y, $location->position->z);

                        // Update the assets location information
                        $asset_data->fill([
                            'map_id'   => $normalized_location['map_id'],
                            'map_name' => $normalized_location['map_name'],
                        ]);
                    }

                    $asset_data->save();
                });
            });

        // items which may not be singleton

        // Get the assets for this character, chunked in a number of blocks
        // that the endpoint will accept.
        CorporationAsset::join('invTypes', 'type_id', '=', 'typeID')
            ->join('invGroups', 'invGroups.groupID', '=', 'invTypes.groupID')
            ->where('corporation_id', $this->getCorporationId())
            // it seems only items from that categories can have a specific location
            // 46 : Orbitals
            ->whereIn('categoryID', [46])
            ->select('item_id')
            ->chunk($this->item_id_limit, function ($item_ids) {

                $this->request_body = $item_ids->pluck('item_id')->all();

                $locations = $this->retrieve([
                    'corporation_id' => $this->getCorporationId(),
                ]);

                collect($locations)->each(function ($location) {

                    $asset_data = CorporationAsset::where('corporation_id', $this->getCorporationId())
                        ->where('item_id', $location->item_id)
                        ->first();

                    // Location for items in either hangar or stations match to 0, 0, 0
                    $asset_data->fill([
                        'x'        => $location->position->x,
                        'y'        => $location->position->y,
                        'z'        => $location->position->z,
                        'map_id'   => 0,
                        'map_name' => '',
                    ]);

                    // If we have a non zero value for coordinates, attempt to identify a celestial.
                    if (($location->position->x + $location->position->y + $location->position->y) !== 0) {
                        $normalized_location = $this->find_nearest_celestial(
                            $asset_data->location_id,
                            $location->position->x, $location->position->y, $location->position->z);

                        // Update the assets location information
                        $asset_data->fill([
                            'map_id' => $normalized_location['map_id'],
                            'map_name' => $normalized_location['map_name'],
                        ]);
                    }

                    $asset_data->save();
                });
            });
    }
105243
protected function job(): void
    {
        while (true) {

            $structures = $this->retrieve([
                'corporation_id' => $this->getCorporationId(),
            ]);

            if ($structures->isCachedLoad()) return;

            collect($structures)->each(function ($structure) {

                // Ensure that we have an entry for this structure_id in the
                // UniverseStructures model. We set the name to unknown for now
                // but this will update when that models updater runs.
                $model = UniverseStructure::firstOrNew([
                    'structure_id' => $structure->structure_id,
                ])->fill([
                    'solar_system_id' => $structure->system_id,
                    'type_id'         => $structure->type_id,
                    'name'            => 'Unknown Structure',
                    'x'               => 0.0,
                    'y'               => 0.0,
                    'z'               => 0.0,
                ]);

                // Persist the structure only if it doesn't already exists
                if (! $model->exists) $model->save();

                CorporationStructure::firstOrNew([
                    'corporation_id' => $structure->corporation_id,
                    'structure_id'   => $structure->structure_id,
                ])->fill([
                    'type_id'                => $structure->type_id,
                    'system_id'              => $structure->system_id,
                    'profile_id'             => $structure->profile_id,
                    'fuel_expires'           => property_exists($structure, 'fuel_expires') ?
                        carbon($structure->fuel_expires) : null,
                    'state_timer_start'      => property_exists($structure, 'state_timer_start') ?
                        carbon($structure->state_timer_start) : null,
                    'state_timer_end'        => property_exists($structure, 'state_timer_end') ?
                        carbon($structure->state_timer_end) : null,
                    'unanchors_at'           => property_exists($structure, 'unanchors_at') ?
                        carbon($structure->unanchors_at) : null,
                    'state'                  => $structure->state,
                    'reinforce_weekday'      => $structure->reinforce_weekday ?? null,
                    'reinforce_hour'         => $structure->reinforce_hour,
                    'next_reinforce_weekday' => $structure->next_reinforce_weekday ?? null,
                    'next_reinforce_hour'    => $structure->next_reinforce_hour ?? null,
                    'next_reinforce_apply'   => property_exists($structure, 'next_reinforce_apply') ?
                        carbon($structure->next_reinforce_apply) : null,
                ])->save();

                if (property_exists($structure, 'services')) {

                    collect($structure->services)->each(function ($service) use ($structure) {

                        CorporationStructureService::firstOrNew([
                            'corporation_id' => $structure->corporation_id,
                            'structure_id'   => $structure->structure_id,
                            'name'           => $service->name,
                        ])->fill([
                            'state' => $service->state,
                        ])->save();
                    });

                    // Cleanup Services that may no longer be applicable to this structure.
                    CorporationStructureService::where('corporation_id', $structure->corporation_id)
                        ->where('structure_id', $structure->structure_id)
                        ->whereNotIn('name', collect($structure->services)
                            ->pluck('name')->flatten()->all())
                        ->delete();

                } else {

                    // If no services are defined on this structure, remove all of the
                    // ones we might have in the database.
                    CorporationStructureService::where('corporation_id', $structure->corporation_id)
                        ->where('structure_id', $structure->structure_id)
                        ->delete();
                }

                $this->known_structures->push($structure->structure_id);
            });

            if (! $this->nextPage($structures->pages))
                break;
        }

        // Cleanup services and structures that were not in the response.
        CorporationStructureService::where('corporation_id', $this->getCorporationId())
            ->whereNotIn('structure_id', $this->known_structures->flatten()->all())
            ->delete();

        CorporationStructure::where('corporation_id', $this->getCorporationId())
            ->whereNotIn('structure_id', $this->known_structures->flatten()->all())
            ->delete();
    }
1346383
public void submit() throws IOException, InterruptedException,
                              ClassNotFoundException {
    ensureState(JobState.DEFINE);
    setUseNewAPI();
    info = jobClient.submitJobInternal(conf);
    state = JobState.RUNNING;
   }
865049
protected function job(): void
    {
        // Get the assets for this character, chunked in a number of blocks
        // that the endpoint will accept.
        CorporationAsset::join('invTypes', 'type_id', '=', 'typeID')
            ->join('invGroups', 'invGroups.groupID', '=', 'invTypes.groupID')
            ->where('corporation_id', $this->getCorporationId())
            ->where('is_singleton', true)// only singleton items may be named
            // it seems only items from that categories can be named
            // 2  : Celestial
            // 6  : Ship
            // 22 : Deployable
            // 23 : Starbase
            // 46 : Orbitals
            // 65 : Structure
            ->whereIn('categoryID', [2, 6, 22, 23, 46, 65])// it seems only items from that categories can be named
            ->select('item_id')
            ->chunk($this->item_id_limit, function ($item_ids) {

                $this->request_body = $item_ids->pluck('item_id')->all();

                $names = $this->retrieve([
                    'corporation_id' => $this->getCorporationId(),
                ]);

                collect($names)->each(function ($name) {

                    // "None" seems to indidate that no name is set.
                    if ($name->name === 'None')
                        return;

                    CorporationAsset::where('corporation_id', $this->getCorporationId())
                        ->where('item_id', $name->item_id)
                        ->update(['name' => $name->name]);
                });
            });
    }
27683
def submit(self, job):
        
        script = self._printer.generate(job)
        stdin, stdout, stderr = self._ssh.exec_command('sbatch')
        stdin.write(script)
        stdin.flush()
        stdin.channel.shutdown_write()
        return stdout.read()
310573
def register_job_definition(self, json_fpath):
        """"""
        with open(json_fpath) as f:
            job_def = json.load(f)
        response = self._client.register_job_definition(**job_def)
        status_code = response['ResponseMetadata']['HTTPStatusCode']
        if status_code != 200:
            msg = 'Register job definition request received status code {0}:\n{1}'
            raise Exception(msg.format(status_code, response))
        return response