Cancel the specified search jobs
190666
function(sids, options, callback) {
            _check_sids('cancel', sids);

            // For each of the supplied sids, cancel the job.
            this._foreach(sids, function(job, idx, done) {
                job.cancel(function (err) { 
                    if (err) {
                        done(err);
                        return;
                    }
                    
                    console.log("  Job " + job.sid + " cancelled"); 
                    done(); 
                });
            }, callback);
        }
1326700
def stop(args):
  """"""
  if args.local:
    raise ValueError("Stopping commands locally is not supported (please kill them yourself)")
  jm = setup(args)
  jm.stop_jobs(get_ids(args.job_ids))
1248210
private void cancel(@Nullable ScheduledFuture<?> future) {
        if (future != null && !future.isCancelled()) {
            if (!future.cancel(true)) {
                LOG.warn("Couldn't cancel field type update job");
            }
        }
    }
803754
def cancelMatchRequest(cfg):
    """"""
    payload = json.dumps([cfg.thePlayer])
    ladder = cfg.ladder
    return requests.post(
        url  = c.URL_BASE%(ladder.ipAddress, ladder.serverPort, "cancelmatch"),
        data = payload,
        #headers=headers,
    )
500680
def cancelAllPendingResults( self ):
        """"""
        for k in self._results.keys():
            rs = self._results[k]
            self._results[k] = [ j for j in rs if isinstance(j, dict) ]
        self._pending = dict()
889121
async def _cancel_payloads(self):
        """"""
        for task in self._tasks:
            task.cancel()
            await asyncio.sleep(0)
        for task in self._tasks:
            while not task.done():
                await asyncio.sleep(0.1)
                task.cancel()
951062
public function cancel()
    {
        $this->stopped();

        $this->setStatus(Job::STATUS_CANCELLED);

        $this->redis->zadd(Queue::redisKey($this->queue, 'cancelled'), time(), $this->payload);
        Stats::incr('cancelled', 1);
        Stats::incr('cancelled', 1, Queue::redisKey($this->queue, 'stats'));

        Event::fire(Event::JOB_CANCELLED, $this);
    }
303437
def _abortJobs( self, js ):
        """"""
        self.open()
        self._client.abort(jobs = js)
        self.close()
177210
def cancel(self, method):
        """"""
        if method in self._scheduledMethods:
            self._scheduledMethods.remove(method)

        if not self._scheduledMethods:
            self._timer.stop()
940487
def delete(args):
  """"""
  jm = setup(args)
  # first, stop the jobs if they are running in the grid
  if not args.local and 'executing' in args.status:
    stop(args)
  # then, delete them from the database
  jm.delete(job_ids=get_ids(args.job_ids), array_ids=get_ids(args.array_ids), delete_logs=not args.keep_logs, delete_log_dir=not args.keep_log_dir, status=args.status)
750022
function excuteJob(){
  let job = peekNextJob();
  let nextJob;

  while(!!job && (job.excuteTime()-Date.now())<accuracy){
    job.run();
    queue.pop();

    let nextTime = job.nextTime();

    if(nextTime === null){
      delete map[job.id];
    }else{
      queue.offer({id:job.id, time: nextTime});
    }
    job = peekNextJob();
  }

  //If all the job have been canceled
  if(!job)
    return;

  //Run next schedule
  setTimer(job);
}
594206
def cancel(id)
      Log.warn "Cancelling job id #{id}"
      job = @jobs_by_id[id]
      job.status = Executor::STATUS_ERROR
      job.owner = nil
      job.time_end = Time.now
      @queue.delete(job)
    end
1044079
@CommandArgument
  public void cancel(int index) {
    if (jobProgressStates == null) {
      System.err.println("Server not running");
      return;
    }
    if (index <= 0 || index > jobProgressStates.size()) {
      System.err.println("Invalid job number");
    }
    ProgressState state = jobProgressStates.get(index - 1);
    state.setCancelPending();
  }
480129
protected function discardJob()
    {
        $this->skipped = true;

        // If we do not have dirty records, then assume that these dirty records were committed
        // already this request (but probably another job), so we don't need to commit anything else.
        // This could occur if we completed multiple searchupdate jobs in a prior request, and
        // we only need one commit job to commit all of them in the current request.
        if (empty(static::$dirty_indexes)) {
            $this->addMessage("Indexing already completed this request: Discarding this job");
            return;
        }


        // If any commit has run, but some (or all) indexes are un-comitted, we must re-schedule this task.
        // This could occur if we completed a searchupdate job in a prior request, as well as in
        // the current request
        $cooldown = Config::inst()->get(__CLASS__, 'cooldown');
        $now = new DateTime(DBDatetime::now()->getValue());
        $now->add(new DateInterval('PT' . $cooldown . 'S'));
        $runat = $now->Format('Y-m-d H:i:s');

        $this->addMessage("Indexing already run this request, but incomplete. Re-scheduling for {$runat}");

        // Queue after the given cooldown
        static::queue(false, $runat);
    }
976206
def cancel
      # there has got to be a sexy ruby way of doing this
      crawl_statuses.each do |job|
        next unless is_job_running(job.status)
        job_id = job.uuid
        puts 'cancelling job_id: ' + job_id.to_s
        Resque::Plugins::Status::Hash.kill(job_id)
      end

      # and for good measure
      `redis-cli FLUSHALL`

      head :ok
    end
933355
def cancel_requests(self):
        """"""
        self._timer.stop()
        self._job = None
        self._args = None
        self._kwargs = None
1104814
def sigint(self) -> None:
        ''''''

        if self.stop_attempts < 1:
            Log.info('gracefully stopping tasks')
            self.stop_attempts += 1
            self.terminate()

        elif self.stop_attempts < 2:
            Log.info('forcefully cancelling tasks')
            self.stop_attempts += 1
            self.terminate(force=True)

        else:
            Log.info('forcefully stopping event loop')
            self.loop.stop()