use of com.webank.wedatasphere.qualitis.exception.JobKillException in project Qualitis by WeBankFinTech.
the class LinkisJobSubmitter method killJob.
@Override
public JobKillResult killJob(String user, String clusterName, Task task) throws ClusterInfoNotConfigException, JobKillException {
String url = getPath(task.getSubmitAddress()).path(linkisConfig.getKillJob()).path(task.getTaskExecId()).path("kill").queryParam("taskID", task.getTaskRemoteId()).toString();
LOGGER.info("Finish to construct kill job url. Url: {}", url);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("Token-User", user);
headers.add("Token-Code", getToken(clusterName));
HttpEntity<Object> entity = new HttpEntity<>(headers);
LOGGER.info("Start to kill job to linkis. url: {}, method: {}", url, javax.ws.rs.HttpMethod.GET);
Map response = restTemplate.exchange(url, HttpMethod.GET, entity, Map.class).getBody();
LOGGER.info("Succeed to kill job to linkis. response: {}", response);
if (!checkResponse(response)) {
String message = (String) response.get("message");
throw new JobKillException("{&FAILED_TO_KILL_TO_LINKIS}. Exception: " + message);
}
String message = (String) response.get("message");
return new JobKillResult(message);
}
Aggregations