@Test public void assertExplicitReconcile() { Map<String, Set<TaskContext>> runningTaskMap = new HashMap<>(); runningTaskMap.put("transient_test_job", Sets.newHashSet( TaskContext.from("transient_test_job@-@0@-@READY@-@SLAVE-S0@-@UUID"), TaskContext.from("transient_test_job@-@1@-@READY@-@SLAVE-S0@-@UUID"))); when(facadeService.getAllRunningTasks()).thenReturn(runningTaskMap); reconcileService.explicitReconcile(); verify(schedulerDriver).reconcileTasks(taskStatusCaptor.capture()); assertThat(taskStatusCaptor.getValue().size(), is(2)); for (Protos.TaskStatus each : taskStatusCaptor.getValue()) { assertThat(each.getSlaveId().getValue(), is("SLAVE-S0")); assertThat(each.getState(), is(Protos.TaskState.TASK_RUNNING)); } }
public void explicitReconcile() { lock.lock(); try { Set<TaskContext> runningTask = new HashSet<>(); for (Set<TaskContext> each : facadeService.getAllRunningTasks().values()) { runningTask.addAll(each); } if (runningTask.isEmpty()) { return; } log.info("Requesting {} tasks reconciliation with the Mesos master", runningTask.size()); schedulerDriver.reconcileTasks(runningTask.stream().map(each -> TaskStatus.newBuilder().setTaskId(Protos.TaskID.newBuilder().setValue(each.getId()).build()) .setSlaveId(Protos.SlaveID.newBuilder().setValue(each.getSlaveId()).build()) .setState(Protos.TaskState.TASK_RUNNING).build()).collect(Collectors.toList())); } finally { lock.unlock(); } }
ReconcileService extends AbstractScheduledService { public void explicitReconcile() { lock.lock(); try { Set<TaskContext> runningTask = new HashSet<>(); for (Set<TaskContext> each : facadeService.getAllRunningTasks().values()) { runningTask.addAll(each); } if (runningTask.isEmpty()) { return; } log.info("Requesting {} tasks reconciliation with the Mesos master", runningTask.size()); schedulerDriver.reconcileTasks(runningTask.stream().map(each -> TaskStatus.newBuilder().setTaskId(Protos.TaskID.newBuilder().setValue(each.getId()).build()) .setSlaveId(Protos.SlaveID.newBuilder().setValue(each.getSlaveId()).build()) .setState(Protos.TaskState.TASK_RUNNING).build()).collect(Collectors.toList())); } finally { lock.unlock(); } } }
ReconcileService extends AbstractScheduledService { public void explicitReconcile() { lock.lock(); try { Set<TaskContext> runningTask = new HashSet<>(); for (Set<TaskContext> each : facadeService.getAllRunningTasks().values()) { runningTask.addAll(each); } if (runningTask.isEmpty()) { return; } log.info("Requesting {} tasks reconciliation with the Mesos master", runningTask.size()); schedulerDriver.reconcileTasks(runningTask.stream().map(each -> TaskStatus.newBuilder().setTaskId(Protos.TaskID.newBuilder().setValue(each.getId()).build()) .setSlaveId(Protos.SlaveID.newBuilder().setValue(each.getSlaveId()).build()) .setState(Protos.TaskState.TASK_RUNNING).build()).collect(Collectors.toList())); } finally { lock.unlock(); } }  }
ReconcileService extends AbstractScheduledService { public void explicitReconcile() { lock.lock(); try { Set<TaskContext> runningTask = new HashSet<>(); for (Set<TaskContext> each : facadeService.getAllRunningTasks().values()) { runningTask.addAll(each); } if (runningTask.isEmpty()) { return; } log.info("Requesting {} tasks reconciliation with the Mesos master", runningTask.size()); schedulerDriver.reconcileTasks(runningTask.stream().map(each -> TaskStatus.newBuilder().setTaskId(Protos.TaskID.newBuilder().setValue(each.getId()).build()) .setSlaveId(Protos.SlaveID.newBuilder().setValue(each.getSlaveId()).build()) .setState(Protos.TaskState.TASK_RUNNING).build()).collect(Collectors.toList())); } finally { lock.unlock(); } }  void explicitReconcile(); void implicitReconcile(); }
ReconcileService extends AbstractScheduledService { public void explicitReconcile() { lock.lock(); try { Set<TaskContext> runningTask = new HashSet<>(); for (Set<TaskContext> each : facadeService.getAllRunningTasks().values()) { runningTask.addAll(each); } if (runningTask.isEmpty()) { return; } log.info("Requesting {} tasks reconciliation with the Mesos master", runningTask.size()); schedulerDriver.reconcileTasks(runningTask.stream().map(each -> TaskStatus.newBuilder().setTaskId(Protos.TaskID.newBuilder().setValue(each.getId()).build()) .setSlaveId(Protos.SlaveID.newBuilder().setValue(each.getSlaveId()).build()) .setState(Protos.TaskState.TASK_RUNNING).build()).collect(Collectors.toList())); } finally { lock.unlock(); } }  void explicitReconcile(); void implicitReconcile();  }