Deletes cron job with the given URN.
357783
def DeleteJob(self, job_id, token=None):
    """"""
    job_urn = self.CRON_JOBS_PATH.Add(job_id)
    aff4.FACTORY.Delete(job_urn, token=token)
60083
synchronized void unschedule(String scheduledJobId) {
    try {
      quartzScheduler.deleteJob(new JobKey(scheduledJobId, SCHEDULED_JOB_GROUP));
    } catch (SchedulerException e) {
      String message = format("Error deleting ScheduledJob ''{0}''", scheduledJobId);
      LOG.error(message, e);
      throw new ScheduledJobException(message, e);
    }
  }
1023376
function destroy(instance, tx, callback) {
    var
        model = instance.__model,
        sql = utils.format('delete from `%s` where `%s`=?', model.__table, model.__primaryKey),
        params = [instance[model.__primaryKey]];
    smartRunSQL(model.__pool, sql, params, tx, function (err, result) {
        if (err) {
            return callback(err);
        }
        callback(null, instance);
    });
}
318997
def rest_delete(url, timeout):
    ''''''
    try:
        response = requests.delete(url, timeout=timeout)
        return response
    except Exception as e:
        print('Get exception {0} when sending http delete to url {1}'.format(str(e), url))
        return None
932447
@Override
  public Job removeJob(final JobId id, final String token)
      throws JobDoesNotExistException, JobStillDeployedException, TokenVerificationException {
    log.info("removing job: id={}", id);
    final ZooKeeperClient client = provider.get("removeJob");
    final Job job = getJob(client, id);
    if (job == null) {
      throw new JobDoesNotExistException(id);
    }
    verifyToken(token, job);

    // TODO (dano): handle retry failures
    try {
      final ImmutableList.Builder<ZooKeeperOperation> operations = ImmutableList.builder();
      final UUID jobCreationOperationId = getJobCreation(client, id);
      if (jobCreationOperationId != null) {
        operations.add(delete(Paths.configJobCreation(id, jobCreationOperationId)));
      }
      operations.add(delete(Paths.configJobHosts(id)),
          delete(Paths.configJobRefShort(id)),
          delete(Paths.configJob(id)),
          // Touch the jobs root node so that its version is bumped on every job
          // change down the tree. Effectively, make it that version == cVersion.
          set(Paths.configJobs(), UUID.randomUUID().toString().getBytes()));
      client.transaction(operations.build());
    } catch (final NoNodeException e) {
      throw new JobDoesNotExistException(id);
    } catch (final NotEmptyException e) {
      throw new JobStillDeployedException(id, listJobHosts(client, id));
    } catch (final KeeperException e) {
      throw new HeliosRuntimeException("removing job " + id + " failed", e);
    }

    // Delete job history on a best effort basis
    try {
      client.deleteRecursive(Paths.historyJob(id));
    } catch (NoNodeException ignored) {
      // There's no history for this job
    } catch (KeeperException e) {
      log.warn("error removing job history for job {}", id, e);
    }

    return job;
  }
481151
def DeleteOldCronJobRuns(self, cutoff_timestamp):
    """"""
    deleted = 0
    for run in list(itervalues(self.cronjob_runs)):
      if run.timestamp < cutoff_timestamp:
        del self.cronjob_runs[(run.cron_job_id, run.run_id)]
        deleted += 1

    return deleted
407859
def _purge_jobs(timestamp):
    '''
    
    '''
    with _get_serv() as cur:
        try:
            sql = 'delete from `jids` where jid in (select distinct jid from salt_returns where alter_time < %s)'
            cur.execute(sql, (timestamp,))
            cur.execute('COMMIT')
        except MySQLdb.Error as e:
            log.error('mysql returner archiver was unable to delete contents of table \'jids\'')
            log.error(six.text_type(e))
            raise salt.exceptions.SaltRunnerError(six.text_type(e))

        try:
            sql = 'delete from `salt_returns` where alter_time < %s'
            cur.execute(sql, (timestamp,))
            cur.execute('COMMIT')
        except MySQLdb.Error as e:
            log.error('mysql returner archiver was unable to delete contents of table \'salt_returns\'')
            log.error(six.text_type(e))
            raise salt.exceptions.SaltRunnerError(six.text_type(e))

        try:
            sql = 'delete from `salt_events` where alter_time < %s'
            cur.execute(sql, (timestamp,))
            cur.execute('COMMIT')
        except MySQLdb.Error as e:
            log.error('mysql returner archiver was unable to delete contents of table \'salt_events\'')
            log.error(six.text_type(e))
            raise salt.exceptions.SaltRunnerError(six.text_type(e))

    return True
9594
def TerminateStuckRunIfNeeded(self, job):
    """"""
    if job.current_run_id and job.last_run_time and job.lifetime:
      now = rdfvalue.RDFDatetime.Now()
      # We add additional 10 minutes to give the job run a chance to kill itself
      # during one of the HeartBeat calls (HeartBeat checks if a cron job is
      # run is running too long and raises if it is).
      expiration_time = (
          job.last_run_time + job.lifetime + rdfvalue.Duration("10m"))
      if now > expiration_time:
        run = data_store.REL_DB.ReadCronJobRun(job.cron_job_id,
                                               job.current_run_id)
        run.status = "LIFETIME_EXCEEDED"
        run.finished_at = now
        data_store.REL_DB.WriteCronJobRun(run)
        data_store.REL_DB.UpdateCronJob(
            job.cron_job_id, current_run_id=None, last_run_status=run.status)
        stats_collector_instance.Get().RecordEvent(
            "cron_job_latency", (now - job.last_run_time).seconds,
            fields=[job.cron_job_id])
        stats_collector_instance.Get().IncrementCounter(
            "cron_job_timeout", fields=[job.cron_job_id])

        return True

    return False
362472
public function cancel_process() {
		if ( ! $this->is_queue_empty() ) {
			$batch = $this->get_batch();

			$this->delete( $batch->key );

			wp_clear_scheduled_hook( $this->cron_hook_identifier );
		}

	}
499660
protected function clear_scheduled_event() {
		$timestamp = wp_next_scheduled( $this->cron_hook_identifier );

		if ( $timestamp ) {
			wp_unschedule_event( $timestamp, $this->cron_hook_identifier );
		}
	}
1180056
async def delCronJob(self, iden):
        '''
        
        '''
        cron = self.cell.agenda.appts.get(iden)
        if cron is None:
            raise s_exc.NoSuchIden()
        self._trig_auth_check(cron.useriden)
        await self.cell.agenda.delete(iden)
794474
public String doDelete(String url) throws IOException {
        HttpDelete httpDelete = new HttpDelete(getWsapiUrl() + url);
        return doRequest(httpDelete);
    }
732182
def KillOldFlows(self):
    
    if not self.IsRunning():
      return False

    start_time = self.Get(self.Schema.LAST_RUN_TIME)
    lifetime = self.Get(self.Schema.CRON_ARGS).lifetime

    elapsed = rdfvalue.RDFDatetime.Now() - start_time

    if lifetime and elapsed > lifetime:
      self.StopCurrentRun()
      stats_collector_instance.Get().IncrementCounter(
          "cron_job_timeout", fields=[self.urn.Basename()])
      stats_collector_instance.Get().RecordEvent(
          "cron_job_latency", elapsed.seconds, fields=[self.urn.Basename()])
      return True

    return False
895184
def destroy(self, url, recursive=False):
        """"""
        bucket, obj_key = _parse_url(url)

        if not bucket:
            raise InvalidURL(url,
                             "You must specify a bucket and (optional) path")

        if obj_key:
            target = "/".join((bucket, obj_key))
        else:
            target = bucket

        if recursive:
            for obj in self.get(url, delimiter=''):
                self.destroy(obj['url'])

        return self.call("DeleteBucket", bucket=target)
10268
def RunOnce(self, token=None, force=False, names=None):
    
    names = names or self.ListJobs(token=token)
    urns = [self.CRON_JOBS_PATH.Add(name) for name in names]

    for cron_job_urn in urns:
      try:
        with aff4.FACTORY.OpenWithLock(
            cron_job_urn, blocking=False, token=token,
            lease_time=600) as cron_job:
          try:
            logging.info("Running cron job: %s", cron_job.urn)
            cron_job.Run(force=force)
          except Exception as e:  # pylint: disable=broad-except
            logging.exception("Error processing cron job %s: %s", cron_job.urn,
                              e)
            stats_collector_instance.Get().IncrementCounter(
                "cron_internal_error")

      except aff4.LockError:
        pass
890628
public void deleteJob( String jobId ) throws SchedulerWsException {

		this.logger.finer( "Deleting scheduled job: " + jobId  );

		WebResource path = this.resource.path( UrlConstants.SCHEDULER ).path( jobId );
		ClientResponse response = this.wsClient.createBuilder( path )
						.accept( MediaType.APPLICATION_JSON )
						.delete( ClientResponse.class );

		handleResponse( response );
	}
118603
def Start(self):
    """"""
    cron_jobs_ttl = config.CONFIG["DataRetention.cron_jobs_flows_ttl"]
    if not cron_jobs_ttl:
      self.Log("TTL not set - nothing to do...")
      return

    manager = aff4_cronjobs.GetCronManager()
    cutoff_timestamp = rdfvalue.RDFDatetime.Now() - cron_jobs_ttl
    if data_store.RelationalDBEnabled():
      deletion_count = manager.DeleteOldRuns(cutoff_timestamp=cutoff_timestamp)

    else:
      deletion_count = 0
      for job in manager.ReadJobs(token=self.token):
        deletion_count += manager.DeleteOldRuns(
            job, cutoff_timestamp=cutoff_timestamp, token=self.token)
        self.HeartBeat()

    self.Log("Deleted %d cron job runs." % deletion_count)