@Test public void testFailuresInLaunchPath() { initRequest(); initFirstDeploy(); SingularityTask task = prepTask(); taskManager.createTaskAndDeletePendingTask(task); resourceOffers(); Assert.assertTrue(taskManager.getActiveTaskIds().size() == 1); startup.checkSchedulerForInconsistentState(); resourceOffers(); Assert.assertTrue(taskManager.getActiveTaskIds().size() == 1); taskManager.deleteActiveTask(task.getTaskId().getId()); resourceOffers(); Assert.assertTrue(taskManager.getActiveTaskIds().size() == 0); startup.checkSchedulerForInconsistentState(); resourceOffers(); Assert.assertTrue(taskManager.getActiveTaskIds().size() == 1); }
@VisibleForTesting void checkSchedulerForInconsistentState() { final long now = System.currentTimeMillis(); final Map<SingularityDeployKey, SingularityPendingTaskId> deployKeyToPendingTaskId = getDeployKeyToPendingTaskId(); for (SingularityRequestWithState requestWithState : requestManager.getRequests()) { switch (requestWithState.getState()) { case ACTIVE: case SYSTEM_COOLDOWN: case DEPLOYING_TO_UNPAUSE: checkActiveRequest(requestWithState, deployKeyToPendingTaskId, now); break; case DELETED: case PAUSED: case FINISHED: break; } } }
SingularityStartup { @VisibleForTesting void checkSchedulerForInconsistentState() { final long now = System.currentTimeMillis(); final Map<SingularityDeployKey, SingularityPendingTaskId> deployKeyToPendingTaskId = getDeployKeyToPendingTaskId(); for (SingularityRequestWithState requestWithState : requestManager.getRequests()) { switch (requestWithState.getState()) { case ACTIVE: case SYSTEM_COOLDOWN: case DEPLOYING_TO_UNPAUSE: checkActiveRequest(requestWithState, deployKeyToPendingTaskId, now); break; case DELETED: case PAUSED: case FINISHED: break; } } } }
SingularityStartup { @VisibleForTesting void checkSchedulerForInconsistentState() { final long now = System.currentTimeMillis(); final Map<SingularityDeployKey, SingularityPendingTaskId> deployKeyToPendingTaskId = getDeployKeyToPendingTaskId(); for (SingularityRequestWithState requestWithState : requestManager.getRequests()) { switch (requestWithState.getState()) { case ACTIVE: case SYSTEM_COOLDOWN: case DEPLOYING_TO_UNPAUSE: checkActiveRequest(requestWithState, deployKeyToPendingTaskId, now); break; case DELETED: case PAUSED: case FINISHED: break; } } } @Inject  SingularityStartup(MesosClient mesosClient, SingularityHealthchecker healthchecker, SingularityNewTaskChecker newTaskChecker,
      SingularitySlaveAndRackManager slaveAndRackManager, TaskManager taskManager, RequestManager requestManager, DeployManager deployManager, SingularityTaskReconciliation taskReconciliation,
      ZkDataMigrationRunner zkDataMigrationRunner); }
SingularityStartup { @VisibleForTesting void checkSchedulerForInconsistentState() { final long now = System.currentTimeMillis(); final Map<SingularityDeployKey, SingularityPendingTaskId> deployKeyToPendingTaskId = getDeployKeyToPendingTaskId(); for (SingularityRequestWithState requestWithState : requestManager.getRequests()) { switch (requestWithState.getState()) { case ACTIVE: case SYSTEM_COOLDOWN: case DEPLOYING_TO_UNPAUSE: checkActiveRequest(requestWithState, deployKeyToPendingTaskId, now); break; case DELETED: case PAUSED: case FINISHED: break; } } } @Inject  SingularityStartup(MesosClient mesosClient, SingularityHealthchecker healthchecker, SingularityNewTaskChecker newTaskChecker,
      SingularitySlaveAndRackManager slaveAndRackManager, TaskManager taskManager, RequestManager requestManager, DeployManager deployManager, SingularityTaskReconciliation taskReconciliation,
      ZkDataMigrationRunner zkDataMigrationRunner); void startup(MasterInfo masterInfo, SchedulerDriver driver); }
SingularityStartup { @VisibleForTesting void checkSchedulerForInconsistentState() { final long now = System.currentTimeMillis(); final Map<SingularityDeployKey, SingularityPendingTaskId> deployKeyToPendingTaskId = getDeployKeyToPendingTaskId(); for (SingularityRequestWithState requestWithState : requestManager.getRequests()) { switch (requestWithState.getState()) { case ACTIVE: case SYSTEM_COOLDOWN: case DEPLOYING_TO_UNPAUSE: checkActiveRequest(requestWithState, deployKeyToPendingTaskId, now); break; case DELETED: case PAUSED: case FINISHED: break; } } } @Inject  SingularityStartup(MesosClient mesosClient, SingularityHealthchecker healthchecker, SingularityNewTaskChecker newTaskChecker,
      SingularitySlaveAndRackManager slaveAndRackManager, TaskManager taskManager, RequestManager requestManager, DeployManager deployManager, SingularityTaskReconciliation taskReconciliation,
      ZkDataMigrationRunner zkDataMigrationRunner); void startup(MasterInfo masterInfo, SchedulerDriver driver);  }