@Test public void setTaskHistoryLimit() throws Exception { clusterManager.setTaskHistoryLimit(0); Integer taskHistoryLimit = clusterManager.getTaskHistoryLimit(); assertEquals(0, (long) taskHistoryLimit); clusterManager.setTaskHistoryLimit(5); }
public void setTaskHistoryLimit(Integer taskHistoryLimit) throws DockerException, InterruptedException { OrchestrationConfig orchestrationConfig = OrchestrationConfig.builder() .taskHistoryRetentionLimit(0) .build(); SwarmSpec currentSwarmSpec = dockerClient.inspectSwarm().swarmSpec(); SwarmSpec updatedSwarmSpec = SwarmSpec.builder() .orchestration(orchestrationConfig) .caConfig(currentSwarmSpec.caConfig()) .dispatcher(currentSwarmSpec.dispatcher()) .encryptionConfig(currentSwarmSpec.encryptionConfig()) .labels(currentSwarmSpec.labels()) .name(currentSwarmSpec.name()) .raft(currentSwarmSpec.raft()) .taskDefaults(currentSwarmSpec.taskDefaults()) .build(); Version swarmVersion = dockerClient.inspectSwarm().version(); dockerClient.updateSwarm(swarmVersion.index(), updatedSwarmSpec); }
ClusterManagerImpl implements ClusterManager { public void setTaskHistoryLimit(Integer taskHistoryLimit) throws DockerException, InterruptedException { OrchestrationConfig orchestrationConfig = OrchestrationConfig.builder() .taskHistoryRetentionLimit(0) .build(); SwarmSpec currentSwarmSpec = dockerClient.inspectSwarm().swarmSpec(); SwarmSpec updatedSwarmSpec = SwarmSpec.builder() .orchestration(orchestrationConfig) .caConfig(currentSwarmSpec.caConfig()) .dispatcher(currentSwarmSpec.dispatcher()) .encryptionConfig(currentSwarmSpec.encryptionConfig()) .labels(currentSwarmSpec.labels()) .name(currentSwarmSpec.name()) .raft(currentSwarmSpec.raft()) .taskDefaults(currentSwarmSpec.taskDefaults()) .build(); Version swarmVersion = dockerClient.inspectSwarm().version(); dockerClient.updateSwarm(swarmVersion.index(), updatedSwarmSpec); } }
ClusterManagerImpl implements ClusterManager { public void setTaskHistoryLimit(Integer taskHistoryLimit) throws DockerException, InterruptedException { OrchestrationConfig orchestrationConfig = OrchestrationConfig.builder() .taskHistoryRetentionLimit(0) .build(); SwarmSpec currentSwarmSpec = dockerClient.inspectSwarm().swarmSpec(); SwarmSpec updatedSwarmSpec = SwarmSpec.builder() .orchestration(orchestrationConfig) .caConfig(currentSwarmSpec.caConfig()) .dispatcher(currentSwarmSpec.dispatcher()) .encryptionConfig(currentSwarmSpec.encryptionConfig()) .labels(currentSwarmSpec.labels()) .name(currentSwarmSpec.name()) .raft(currentSwarmSpec.raft()) .taskDefaults(currentSwarmSpec.taskDefaults()) .build(); Version swarmVersion = dockerClient.inspectSwarm().version(); dockerClient.updateSwarm(swarmVersion.index(), updatedSwarmSpec); } ClusterManagerImpl(); }
ClusterManagerImpl implements ClusterManager { public void setTaskHistoryLimit(Integer taskHistoryLimit) throws DockerException, InterruptedException { OrchestrationConfig orchestrationConfig = OrchestrationConfig.builder() .taskHistoryRetentionLimit(0) .build(); SwarmSpec currentSwarmSpec = dockerClient.inspectSwarm().swarmSpec(); SwarmSpec updatedSwarmSpec = SwarmSpec.builder() .orchestration(orchestrationConfig) .caConfig(currentSwarmSpec.caConfig()) .dispatcher(currentSwarmSpec.dispatcher()) .encryptionConfig(currentSwarmSpec.encryptionConfig()) .labels(currentSwarmSpec.labels()) .name(currentSwarmSpec.name()) .raft(currentSwarmSpec.raft()) .taskDefaults(currentSwarmSpec.taskDefaults()) .build(); Version swarmVersion = dockerClient.inspectSwarm().version(); dockerClient.updateSwarm(swarmVersion.index(), updatedSwarmSpec); } ClusterManagerImpl(); Info getClusterInfo(); long getNumberOfNodes(); long getNumberOfNodes(String label); boolean isClusterHealthy(); long getExpectedNumberOfNodes(); void setTaskHistoryLimit(Integer taskHistoryLimit); int getTaskHistoryLimit(); }
ClusterManagerImpl implements ClusterManager { public void setTaskHistoryLimit(Integer taskHistoryLimit) throws DockerException, InterruptedException { OrchestrationConfig orchestrationConfig = OrchestrationConfig.builder() .taskHistoryRetentionLimit(0) .build(); SwarmSpec currentSwarmSpec = dockerClient.inspectSwarm().swarmSpec(); SwarmSpec updatedSwarmSpec = SwarmSpec.builder() .orchestration(orchestrationConfig) .caConfig(currentSwarmSpec.caConfig()) .dispatcher(currentSwarmSpec.dispatcher()) .encryptionConfig(currentSwarmSpec.encryptionConfig()) .labels(currentSwarmSpec.labels()) .name(currentSwarmSpec.name()) .raft(currentSwarmSpec.raft()) .taskDefaults(currentSwarmSpec.taskDefaults()) .build(); Version swarmVersion = dockerClient.inspectSwarm().version(); dockerClient.updateSwarm(swarmVersion.index(), updatedSwarmSpec); } ClusterManagerImpl(); Info getClusterInfo(); long getNumberOfNodes(); long getNumberOfNodes(String label); boolean isClusterHealthy(); long getExpectedNumberOfNodes(); void setTaskHistoryLimit(Integer taskHistoryLimit); int getTaskHistoryLimit();  }