Erase a single job of a project (remove job artifacts and a job trace)

@param projectId
@param jobId
@return
@throws IOException on gitlab api call error
427460
public GitlabJob eraseJob(Integer projectId, Integer jobId) throws IOException {
        String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabJob.URL + "/" + sanitizeId(jobId, "JobID") + "/erase";
        return dispatch().to(tailUrl, GitlabJob.class);
    }
607502
protected void removeExecutionLink(JobEntity jobEntity) {
        if (jobEntity.getExecutionId() != null) {
            ExecutionEntity execution = getExecutionEntityManager().findById(jobEntity.getExecutionId());
            if (execution != null) {
                execution.getJobs().remove(jobEntity);
            }
        }
    }
831505
private void cleanup(final String taskId)
  {
    if (!lifecycleLock.awaitStarted(1, TimeUnit.SECONDS)) {
      return;
    }
    final RemoteTaskRunnerWorkItem removed = completeTasks.remove(taskId);
    final Worker worker = removed.getWorker();
    if (removed == null || worker == null) {
      log.makeAlert("WTF?! Asked to cleanup nonexistent task")
         .addData("taskId", taskId)
         .emit();
    } else {
      final String workerId = worker.getHost();
      log.info("Cleaning up task[%s] on worker[%s]", taskId, workerId);
      final String statusPath = JOINER.join(indexerZkConfig.getStatusPath(), workerId, taskId);
      try {
        cf.delete().guaranteed().forPath(statusPath);
      }
      catch (KeeperException.NoNodeException e) {
        log.info("Tried to delete status path[%s] that didn't exist! Must've gone away already?", statusPath);
      }
      catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
  }
1049109
protected void removeExecutionLink(TimerJobEntity jobEntity) {
        if (jobEntity.getExecutionId() != null) {
            ExecutionEntity execution = getExecutionEntityManager().findById(jobEntity.getExecutionId());
            if (execution != null) {
                execution.getTimerJobs().remove(jobEntity);
            }
        }
    }
1097196
@PostMapping("/removeMappingProject")
  public String deleteMappingProject(@RequestParam() String mappingProjectId) {
    MappingProject project = mappingService.getMappingProject(mappingProjectId);
    LOG.info("Deleting mappingProject {}", project.getName());
    mappingService.deleteMappingProject(mappingProjectId);
    return "redirect:" + getMappingServiceMenuUrl();
  }
883801
def delete_project(id=None, name=None):
    
    content = delete_project_raw(id, name)
    if content:
        return utils.format_json(content)
903975
def delete_job(job_id,
               deployment_name,
               token_manager=None,
               app_url=defaults.APP_URL):
    
    headers = token_manager.get_access_token_headers()
    data_url = get_data_url_for_job(job_id,
                                    deployment_name,
                                    token_manager=token_manager,
                                    app_url=app_url)

    url = '%s/api/v1/jobs/%s' % (data_url, job_id)
    response = requests.delete(url, headers=headers)

    if response.status_code != 200:
        raise JutException('Error %s: %s' % (response.status_code, response.text))
448797
def delete_job(job_id, connection=None):
    
    if connection is None:
        connection = r
    with connection.pipeline() as pipe:
        pipe.delete(job_key(job_id))
        pipe.zrem(REDIS_KEY, job_id)
        pipe.execute()
745329
def remove_project(self, project_id):
        

        if project_id not in self._projects:
            raise aiohttp.web.HTTPNotFound(text="Project ID {} doesn't exist".format(project_id))
        del self._projects[project_id]
1222999
private void cleanupWorkingDirectory() throws IOException {
    LOGGER.info("Deleting persisted work units for job " + this.jobContext.getJobId());
    stateStores.getWuStateStore().delete(this.jobContext.getJobId());

    // delete the directory that stores the task state files
    stateStores.getTaskStateStore().delete(outputTaskStateDir.getName());

    LOGGER.info("Deleting job state file for job " + this.jobContext.getJobId());

    if (this.stateStores.haveJobStateStore()) {
      this.stateStores.getJobStateStore().delete(this.jobContext.getJobId());
    } else {
      Path jobStateFilePath = GobblinClusterUtils.getJobStateFilePath(false, this.appWorkDir, this.jobContext.getJobId());
      this.fs.delete(jobStateFilePath, false);
    }
  }
137873
public void deleteLabel(Serializable projectId, GitlabLabel label)
            throws IOException {
        deleteLabel(projectId, label.getName());
    }
610849
public void removeProject(String projectName) {
        // It should only be in list once (usually in slot 0) but check entire
        // list...
        Iterator<String> it = recentProjectsList.iterator();
        while (it.hasNext()) {
            // LinkedList, so remove() via iterator is faster than
            // remove(index).
            if (projectName.equals(it.next())) {
                it.remove();
            }
        }
    }
335342
public List<GitlabJob> getProjectJobs(Integer projectId) {
        String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabJob.URL + PARAM_MAX_ITEMS_PER_PAGE;
        return retrieve().getAll(tailUrl, GitlabJob[].class);
    }
321646
public static void qdel(String jobId) {
        final CommandLine cmdLine = new CommandLine(COMMAND_QDEL);
        cmdLine.addArgument(jobId);

        final OutputStream out = new ByteArrayOutputStream();
        final OutputStream err = new ByteArrayOutputStream();

        DefaultExecuteResultHandler resultHandler;
        try {
            resultHandler = execute(cmdLine, null, out, err);
            resultHandler.waitFor(DEFAULT_TIMEOUT);
        } catch (ExecuteException e) {
            throw new PBSException("Failed to execute qdel command: " + e.getMessage(), e);
        } catch (IOException e) {
            throw new PBSException("Failed to execute qdel command: " + e.getMessage(), e);
        } catch (InterruptedException e) {
            throw new PBSException("Failed to execute qdel command: " + e.getMessage(), e);
        }

        final int exitValue = resultHandler.getExitValue();
        LOGGER.info("qdel exit value: " + exitValue);

        if (exitValue != 0)
            throw new PBSException("Failed to delete job " + jobId + ". Error output: " + err.toString());
    }
65527
@Override
    public boolean removeJob(JobKey jobKey, Jedis jedis) throws JobPersistenceException {
        final String jobHashKey = redisSchema.jobHashKey(jobKey);
        final String jobBlockedKey = redisSchema.jobBlockedKey(jobKey);
        final String jobDataMapHashKey = redisSchema.jobDataMapHashKey(jobKey);
        final String jobGroupSetKey = redisSchema.jobGroupSetKey(jobKey);
        final String jobTriggerSetKey = redisSchema.jobTriggersSetKey(jobKey);

        Pipeline pipe = jedis.pipelined();
        // remove the job and any associated data
        Response<Long> delJobHashKeyResponse = pipe.del(jobHashKey);
        // remove the blocked job key
        pipe.del(jobBlockedKey);
        // remove the job's data map
        pipe.del(jobDataMapHashKey);
        // remove the job from the set of all jobs
        pipe.srem(redisSchema.jobsSet(), jobHashKey);
        // remove the job from the set of blocked jobs
        pipe.srem(redisSchema.blockedJobsSet(), jobHashKey);
        // remove the job from its group
        pipe.srem(jobGroupSetKey, jobHashKey);
        // retrieve the keys for all triggers associated with this job, then delete that set
        Response<Set<String>> jobTriggerSetResponse = pipe.smembers(jobTriggerSetKey);
        pipe.del(jobTriggerSetKey);
        Response<Long> jobGroupSetSizeResponse = pipe.scard(jobGroupSetKey);
        pipe.sync();
        if(jobGroupSetSizeResponse.get() == 0){
            // The group now contains no jobs. Remove it from the set of all job groups.
            jedis.srem(redisSchema.jobGroupsSet(), jobGroupSetKey);
        }

        // remove all triggers associated with this job
        pipe = jedis.pipelined();
        for (String triggerHashKey : jobTriggerSetResponse.get()) {
            // get this trigger's TriggerKey
            final TriggerKey triggerKey = redisSchema.triggerKey(triggerHashKey);
            final String triggerGroupSetKey = redisSchema.triggerGroupSetKey(triggerKey);
            unsetTriggerState(triggerHashKey, jedis);
            // remove the trigger from the set of all triggers
            pipe.srem(redisSchema.triggersSet(), triggerHashKey);
            // remove the trigger's group from the set of all trigger groups
            pipe.srem(redisSchema.triggerGroupsSet(), triggerGroupSetKey);
            // remove this trigger from its group
            pipe.srem(triggerGroupSetKey, triggerHashKey);
            // delete the trigger
            pipe.del(triggerHashKey);
        }
        pipe.sync();

        return delJobHashKeyResponse.get() == 1;
    }
123197
public String getProjectJson(Serializable projectId) throws IOException {
        String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId);
        return retrieve().to(tailUrl, String.class);
    }
173936
public void removeRunner(Integer runnerId) throws GitLabApiException {

        if (runnerId == null) {
            throw new RuntimeException("runnerId cannot be null");
        }

        delete(Response.Status.NO_CONTENT, null, "runners", runnerId);
    }