public ExecutableOutputPO getJobOutput(String jobId) { try { return executableDao.getJobOutput(jobId); } catch (PersistentException e) { logger.error("Can't get output of Job " + jobId); throw new RuntimeException(e); } }
public void syncDigestsOfJob(String uuid) throws PersistentException { ExecutablePO job = getJob(uuid); ExecutablePO jobDigest = getJobDigest(uuid); if (job == null && jobDigest != null) { executableDigestMap.remove(uuid); } else if (job != null && jobDigest == null) { executableDigestMap.put(uuid, job); } ExecutableOutputPO jobOutput = getJobOutput(uuid); ExecutableOutputPO jobOutputDigest = getJobOutputDigest(uuid); if (jobOutput == null && jobOutputDigest != null) { executableOutputDigestMap.remove(uuid); } else if (jobOutput != null && jobOutputDigest == null) { executableOutputDigestMap.put(uuid, jobOutput); } } }
public Output getOutput(String uuid) { try { final ExecutableOutputPO jobOutput = executableDao.getJobOutput(uuid); Preconditions.checkArgument(jobOutput != null, "there is no related output for job id:" + uuid); return parseOutput(jobOutput); } catch (PersistentException e) { logger.error("fail to get job output:" + uuid, e); throw new RuntimeException(e); } }
private void extractJobInfo(String taskId, File destDir) throws Exception { final Map<String, String> jobInfo = executableDao.getJobOutput(taskId).getInfo(); if (jobInfo.containsKey(ExecutableConstants.MR_JOB_ID)) { String mrJobId = jobInfo.get(ExecutableConstants.MR_JOB_ID); FileUtils.forceMkdir(destDir); String[] mrJobArgs = { "-mrJobId", mrJobId, "-destDir", destDir.getAbsolutePath(), "-compress", "false", "-submodule", "true" }; new MrJobInfoExtractor().execute(mrJobArgs); } }
private void extractJobLog(String taskId, File destDir, boolean onlyFail) throws Exception { final Map<String, String> jobInfo = executableDao.getJobOutput(taskId).getInfo(); FileUtils.forceMkdir(destDir); if (jobInfo.containsKey(ExecutableConstants.MR_JOB_ID)) { String applicationId = jobInfo.get(ExecutableConstants.MR_JOB_ID).replace("job", "application"); if (!onlyFail || !isYarnAppSucc(applicationId)) { File destFile = new File(destDir, applicationId + ".log"); String yarnCmd = "yarn logs -applicationId " + applicationId + " > " + destFile.getAbsolutePath(); logger.debug(yarnCmd); try { kylinConfig.getCliCommandExecutor().execute(yarnCmd); } catch (Exception ex) { logger.warn("Failed to get yarn logs. ", ex); } } } }
ExecutableOutputPO output = executableDao.getJobOutput(id); Preconditions.checkArgument(output != null, "there is no related output for job id:" + id); output.getInfo().putAll(info);
public void resetJobOutput(String jobId, ExecutableState state, String output) { try { final ExecutableOutputPO jobOutput = executableDao.getJobOutput(jobId); jobOutput.setStatus(state.toString()); if (output != null) { jobOutput.setContent(output); } executableDao.updateJobOutput(jobOutput); } catch (PersistentException e) { throw new RuntimeException(e); } }
public void forceKillJob(String jobId) { try { final ExecutableOutputPO jobOutput = executableDao.getJobOutput(jobId); List<ExecutablePO> tasks = executableDao.getJob(jobId).getTasks(); for (ExecutablePO task : tasks) { if (executableDao.getJobOutput(task.getId()).getStatus().equals("SUCCEED")) { continue; } else if (executableDao.getJobOutput(task.getId()).getStatus().equals("RUNNING")) { updateJobOutput(task.getId(), ExecutableState.READY, Maps.<String, String> newHashMap(), ""); } break; } if (!jobOutput.getStatus().equals(ExecutableState.ERROR.toString())) { jobOutput.setStatus(ExecutableState.ERROR.toString()); executableDao.updateJobOutput(jobOutput); } } catch (PersistentException e) { throw new RuntimeException(e); } }
public void updateJobOutput(String jobId, ExecutableState newStatus, Map<String, String> info, String output) { // when if (Thread.currentThread().isInterrupted()) { throw new RuntimeException("Current thread is interruptted, aborting"); } try { final ExecutableOutputPO jobOutput = executableDao.getJobOutput(jobId); Preconditions.checkArgument(jobOutput != null, "there is no related output for job id:" + jobId); ExecutableState oldStatus = ExecutableState.valueOf(jobOutput.getStatus()); if (newStatus != null && oldStatus != newStatus) { if (!ExecutableState.isValidStateTransfer(oldStatus, newStatus)) { throw new IllegalStateTranferException("there is no valid state transfer from:" + oldStatus + " to:" + newStatus + ", job id: " + jobId); } jobOutput.setStatus(newStatus.toString()); } if (info != null) { jobOutput.getInfo().putAll(info); } if (output != null) { jobOutput.setContent(output); } executableDao.updateJobOutput(jobOutput); logger.info("job id:" + jobId + " from " + oldStatus + " to " + newStatus); } catch (PersistentException e) { logger.error("error change job:" + jobId + " to " + newStatus); throw new RuntimeException(e); } }
for (ExecutablePO executable : allExecutable) { long lastModified = executable.getLastModified(); String jobStatus = executableDao.getJobOutput(executable.getUuid()).getStatus();
for (ExecutablePO executable : allExecutable) { long lastModified = executable.getLastModified(); ExecutableOutputPO output = executableDao.getJobOutput(executable.getUuid()); if (System.currentTimeMillis() - lastModified > TIME_THREADSHOLD_FOR_JOB && (ExecutableState.SUCCEED.toString().equals(output.getStatus()) || ExecutableState.DISCARDED.toString().equals(output.getStatus()))) { toDeleteResource.add(ResourceStore.EXECUTE_RESOURCE_ROOT + "/" + executable.getUuid());
public void addJobInfo(String id, Map<String, String> info) { if (info == null) { return; } try { ExecutableOutputPO output = executableDao.getJobOutput(id); Preconditions.checkArgument(output != null, "there is no related output for job id:" + id); output.getInfo().putAll(info); executableDao.updateJobOutput(output); } catch (PersistentException e) { logger.error("error update job info, id:" + id + " info:" + info.toString()); throw new RuntimeException(e); } }
public void resetJobOutput(String jobId, ExecutableState state, String output) { try { final ExecutableOutputPO jobOutput = executableDao.getJobOutput(jobId); jobOutput.setStatus(state.toString()); if (output != null) { jobOutput.setContent(output); } executableDao.updateJobOutput(jobOutput); } catch (PersistentException e) { throw new RuntimeException(e); } }
public Output getOutput(String uuid) { try { final ExecutableOutputPO jobOutput = executableDao.getJobOutput(uuid); Preconditions.checkArgument(jobOutput != null, "there is no related output for job id:" + uuid); final DefaultOutput result = new DefaultOutput(); result.setExtra(jobOutput.getInfo()); result.setState(ExecutableState.valueOf(jobOutput.getStatus())); result.setVerboseMsg(jobOutput.getContent()); result.setLastModified(jobOutput.getLastModified()); return result; } catch (PersistentException e) { logger.error("fail to get job output:" + uuid, e); throw new RuntimeException(e); } }
public void updateJobOutput(String jobId, ExecutableState newStatus, Map<String, String> info, String output) { try { final ExecutableOutputPO jobOutput = executableDao.getJobOutput(jobId); Preconditions.checkArgument(jobOutput != null, "there is no related output for job id:" + jobId); ExecutableState oldStatus = ExecutableState.valueOf(jobOutput.getStatus()); if (newStatus != null && oldStatus != newStatus) { if (!ExecutableState.isValidStateTransfer(oldStatus, newStatus)) { throw new IllegalStateTranferException("there is no valid state transfer from:" + oldStatus + " to:" + newStatus); } jobOutput.setStatus(newStatus.toString()); } if (info != null) { jobOutput.setInfo(info); } if (output != null) { jobOutput.setContent(output); } executableDao.updateJobOutput(jobOutput); logger.info("job id:" + jobId + " from " + oldStatus + " to " + newStatus); } catch (PersistentException e) { logger.error("error change job:" + jobId + " to " + newStatus.toString()); throw new RuntimeException(e); } }
public ExecutableOutputPO getJobOutput(String jobId) { try { return executableDao.getJobOutput(jobId); } catch (PersistentException e) { logger.error("Can't get output of Job " + jobId); throw new RuntimeException(e); } }
public Output getOutput(String uuid) { try { final ExecutableOutputPO jobOutput = executableDao.getJobOutput(uuid); Preconditions.checkArgument(jobOutput != null, "there is no related output for job id:" + uuid); return parseOutput(jobOutput); } catch (PersistentException e) { logger.error("fail to get job output:" + uuid, e); throw new RuntimeException(e); } }
private void extractJobInfo(String taskId, File destDir) throws Exception { final Map<String, String> jobInfo = executableDao.getJobOutput(taskId).getInfo(); if (jobInfo.containsKey(ExecutableConstants.MR_JOB_ID)) { String mrJobId = jobInfo.get(ExecutableConstants.MR_JOB_ID); FileUtils.forceMkdir(destDir); String[] mrJobArgs = { "-mrJobId", mrJobId, "-destDir", destDir.getAbsolutePath(), "-compress", "false", "-submodule", "true" }; new MrJobInfoExtractor().execute(mrJobArgs); } }
public void resetJobOutput(String jobId, ExecutableState state, String output) { try { final ExecutableOutputPO jobOutput = executableDao.getJobOutput(jobId); jobOutput.setStatus(state.toString()); if (output != null) { jobOutput.setContent(output); } executableDao.updateJobOutput(jobOutput); } catch (PersistentException e) { throw new RuntimeException(e); } }
public void resetJobOutput(String jobId, ExecutableState state, String output) { try { final ExecutableOutputPO jobOutput = executableDao.getJobOutput(jobId); jobOutput.setStatus(state.toString()); if (output != null) { jobOutput.setContent(output); } executableDao.updateJobOutput(jobOutput); } catch (PersistentException e) { throw new RuntimeException(e); } }