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());
public void updateAllRunningJobsToError() { try { final List<ExecutableOutputPO> jobOutputs = executableDao.getJobOutputs(); for (ExecutableOutputPO executableOutputPO : jobOutputs) { if (executableOutputPO.getStatus().equalsIgnoreCase(ExecutableState.RUNNING.toString())) { executableOutputPO.setStatus(ExecutableState.ERROR.toString()); executableDao.updateJobOutput(executableOutputPO); } } } catch (PersistentException e) { logger.error("error reset job status from RUNNING to ERROR", e); throw new RuntimeException(e); } }
public void resumeAllRunningJobs() { try { final List<ExecutableOutputPO> jobOutputs = executableDao.getJobOutputs(); for (ExecutableOutputPO executableOutputPO : jobOutputs) { if (executableOutputPO.getStatus().equalsIgnoreCase(ExecutableState.RUNNING.toString())) { executableOutputPO.setStatus(ExecutableState.READY.toString()); executableDao.updateJobOutput(executableOutputPO); } } } catch (PersistentException e) { logger.error("error reset job status from RUNNING to READY", 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); } }
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); } }
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 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 updateAllRunningJobsToError() { try { final List<ExecutableOutputPO> jobOutputs = executableDao.getJobOutputs(); for (ExecutableOutputPO executableOutputPO : jobOutputs) { if (executableOutputPO.getStatus().equalsIgnoreCase(ExecutableState.RUNNING.toString())) { executableOutputPO.setStatus(ExecutableState.ERROR.toString()); executableDao.updateJobOutput(executableOutputPO); } } } catch (PersistentException e) { logger.error("error reset job status from RUNNING to ERROR", 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); } }
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 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); } }
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());
public void updateAllRunningJobsToError() { try { final List<ExecutableOutputPO> jobOutputs = executableDao.getJobOutputs(); for (ExecutableOutputPO executableOutputPO : jobOutputs) { if (executableOutputPO.getStatus().equalsIgnoreCase(ExecutableState.RUNNING.toString())) { executableOutputPO.setStatus(ExecutableState.ERROR.toString()); executableDao.updateJobOutput(executableOutputPO); } } } catch (PersistentException e) { logger.error("error reset job status from RUNNING to ERROR", e); throw new RuntimeException(e); } }
public void updateAllRunningJobsToError() { try { final List<ExecutableOutputPO> jobOutputs = executableDao.getJobOutputs(); for (ExecutableOutputPO executableOutputPO : jobOutputs) { if (executableOutputPO.getStatus().equalsIgnoreCase(ExecutableState.RUNNING.toString())) { executableOutputPO.setStatus(ExecutableState.ERROR.toString()); executableDao.updateJobOutput(executableOutputPO); } } } catch (PersistentException e) { logger.error("error reset job status from RUNNING to ERROR", e); throw new RuntimeException(e); } }
public void resumeAllRunningJobs() { try { final List<ExecutableOutputPO> jobOutputs = executableDao.getJobOutputs(); for (ExecutableOutputPO executableOutputPO : jobOutputs) { if (executableOutputPO.getStatus().equalsIgnoreCase(ExecutableState.RUNNING.toString())) { executableOutputPO.setStatus(ExecutableState.READY.toString()); executableDao.updateJobOutput(executableOutputPO); } } } catch (PersistentException e) { logger.error("error reset job status from RUNNING to READY", 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); } }
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 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.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); 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 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); } }