@Override
    public void statusUpdate(SchedulerDriver driver, TaskStatus status) {
        TaskID taskId = status.getTaskId();
        LOGGER.log(Level.INFO, "Status update: task {0} is in state {1}", new Object[]{taskId, status.getState()});

        if (!results.containsKey(taskId)) {
            throw new IllegalStateException("Unknown taskId: " + taskId);
        }

        Result result = results.get(taskId);

        switch (status.getState()) {
            case TASK_STAGING:
            case TASK_STARTING:
                break;
            case TASK_RUNNING:
                result.result.running(result.slave);
                break;
            case TASK_FINISHED:
                result.result.finished(result.slave);
                break;
            case TASK_FAILED:
            case TASK_KILLED:
            case TASK_LOST:
                result.result.failed(result.slave);
                break;
            default:
                throw new IllegalStateException("Invalid State: " + status.getState());
        }
    }