/** * Fail a task by setting the status of the task to {@link ClusterTask.Status#FAILED} and the status time to the * current timestamp and the status code to the given code. * * @param clusterTask Task to fail. * @param status Status code of the failed task. * @throws IOException */ public void failTask(ClusterTask clusterTask, int status) throws IOException { clusterTask.setStatus(ClusterTask.Status.FAILED); clusterTask.setStatusCode(status); clusterTask.setStatusTime(System.currentTimeMillis()); clusterStore.writeClusterTask(clusterTask); // Update stats serverStats.getFailedProvisionerStats().incrementStat(clusterTask.getTaskName()); }
/** * Complete a task by setting the status of the task to {@link ClusterTask.Status#COMPLETE} and the status time to * the current timestamp and the status code to the given code. * * @param clusterTask Task to complete. * @param status Status code of the completed task. * @throws IOException */ public void completeTask(ClusterTask clusterTask, int status) throws IOException { clusterTask.setStatus(ClusterTask.Status.COMPLETE); clusterTask.setStatusCode(status); clusterTask.setStatusTime(System.currentTimeMillis()); clusterStore.writeClusterTask(clusterTask); // update stats serverStats.getSuccessfulProvisionerStats().incrementStat(clusterTask.getTaskName()); }