@Override protected ExecuteResult doWork(ExecutableContext context) throws ExecuteException { List<? extends Executable> executables = getTasks(); final int size = executables.size(); for (int i = 0; i < size; ++i) { Executable subTask = executables.get(i); ExecutableState state = subTask.getStatus(); if (state == ExecutableState.RUNNING) { // there is already running subtask, no need to start a new subtask break; } else if (state == ExecutableState.STOPPED) { // the job is paused break; } else if (state == ExecutableState.ERROR) { throw new IllegalStateException( "invalid subtask state, subtask:" + subTask.getName() + ", state:" + subTask.getStatus()); } if (subTask.isRunnable()) { return subTask.execute(context); } } return new ExecuteResult(ExecuteResult.State.SUCCEED); }
"There shouldn't be a running subtask[jobId: {}, jobName: {}], \n" + "it might cause endless state, will retry to fetch subtask's state.", task.getId(), task.getName()); getManager().updateJobOutput(task.getId(), ExecutableState.ERROR, null, "killed due to inconsistent state");
@Override protected ExecuteResult doWork(ExecutableContext context) throws ExecuteException { List<? extends Executable> executables = getTasks(); final int size = executables.size(); for (int i = 0; i < size; ++i) { Executable subTask = executables.get(i); ExecutableState state = subTask.getStatus(); if (state == ExecutableState.RUNNING) { // there is already running subtask, no need to start a new subtask break; } else if (state == ExecutableState.STOPPED) { // the job is paused break; } else if (state == ExecutableState.ERROR) { throw new IllegalStateException( "invalid subtask state, subtask:" + subTask.getName() + ", state:" + subTask.getStatus()); } if (subTask.isRunnable()) { return subTask.execute(context); } } return new ExecuteResult(ExecuteResult.State.SUCCEED); }
"There shouldn't be a running subtask[jobId: {}, jobName: {}], \n" + "it might cause endless state, will retry to fetch subtask's state.", task.getId(), task.getName()); getManager().updateJobOutput(task.getId(), ExecutableState.ERROR, null, "killed due to inconsistent state");