/** * Complete an action on a node. Updates the node in the persistent store. * * @param node Node the completed action took place on. * @throws IOException */ public void completeAction(Node node) throws IOException { Node.Action action = validateAndGetAction(node); action.setStatus(Node.Status.COMPLETE); action.setStatusTime(System.currentTimeMillis()); clusterStore.writeNode(node); }
/** * Fail an action on a node with optional logs on what went wrong. Updates the node in the persistent store. * * @param node Node the action failed on. * @param stdout Stdout of failed action. * @param stderr Stderr of failed action. * @throws IOException */ public void failAction(Node node, String stdout, String stderr) throws IOException { Node.Action action = validateAndGetAction(node); action.setStatus(Node.Status.FAILED); action.setStatusTime(System.currentTimeMillis()); action.setStdout(truncateLog(stdout, maxLogLength)); action.setStderr(truncateLog(stderr, maxLogLength)); clusterStore.writeNode(node); }