public static TaskSpec getTaskSpecWithGoalState(String name, String resourceSetId, GoalState goalState) { return getTaskSpec( name, CMD.getValue(), null, getResourceSet(resourceSetId, CPU, MEM, DISK), Collections.emptyList(), goalState); }
request.setTaskDefinition(taskInfo.getCommand().getValue()); for (final List<String> containerInstances : containerInstancePartitions) { request.setContainerInstances(containerInstances);
@Test public void testAreDifferentTaskSpecificationsConfigsLength() { TaskSpec oldTaskSpecification = TestPodFactory.getTaskSpec(); TaskSpec newTaskSpecification = TestPodFactory.getTaskSpec( TestConstants.TASK_NAME, TestPodFactory.CMD.getValue(), TestPodFactory.getResourceSet(TestConstants.RESOURCE_SET_ID, 1, 2, 3), Arrays.asList(DefaultConfigFileSpec.newBuilder() .name("config") .relativePath("../relative/path/to/config") .templateContent("this is a config template") .build())); Assert.assertTrue(TaskUtils.areDifferent(oldTaskSpecification, newTaskSpecification)); }
TaskSpec oldTaskSpecification = TestPodFactory.getTaskSpec( TestConstants.TASK_NAME, TestPodFactory.CMD.getValue(), TestPodFactory.getResourceSet(TestConstants.RESOURCE_SET_ID, 1, 2, 3), Arrays.asList( TestPodFactory.CMD.getValue(), TestPodFactory.getResourceSet(TestConstants.RESOURCE_SET_ID, 1, 2, 3), Arrays.asList(
TaskSpec oldTaskSpecification = TestPodFactory.getTaskSpec( TestConstants.TASK_NAME, TestPodFactory.CMD.getValue(), TestPodFactory.getResourceSet(TestConstants.RESOURCE_SET_ID, 1, 2, 3), Arrays.asList( TestPodFactory.CMD.getValue(), TestPodFactory.getResourceSet(TestConstants.RESOURCE_SET_ID, 1, 2, 3), Arrays.asList(
@Test public void testAreNotDifferentTaskSpecificationsResourcesMatch() { TaskSpec oldTaskSpecification = TestPodFactory.getTaskSpec( TestConstants.TASK_NAME, TestPodFactory.CMD.getValue(), DefaultResourceSet.newBuilder(TestConstants.ROLE, Constants.ANY_ROLE, TestConstants.PRINCIPAL) .id(TestConstants.RESOURCE_SET_ID) .cpus(5.) .memory(3.) .build()); TaskSpec newTaskSpecification = TestPodFactory.getTaskSpec( TestConstants.TASK_NAME, TestPodFactory.CMD.getValue(), DefaultResourceSet.newBuilder(TestConstants.ROLE, Constants.ANY_ROLE, TestConstants.PRINCIPAL) .id(TestConstants.RESOURCE_SET_ID + "b") .cpus(5.) .memory(3.) .build()); Assert.assertFalse(TaskUtils.areDifferent(oldTaskSpecification, newTaskSpecification)); }
@Test public void testAreDifferentTaskSpecificationsResourcesLength() { TaskSpec oldTaskSpecification = TestPodFactory.getTaskSpec( TestConstants.TASK_NAME, TestPodFactory.CMD.getValue(), DefaultResourceSet.newBuilder(TestConstants.ROLE, Constants.ANY_ROLE, TestConstants.PRINCIPAL) .id(TestConstants.RESOURCE_SET_ID) .cpus(5.) .build()); TaskSpec newTaskSpecification = TestPodFactory.getTaskSpec( TestConstants.TASK_NAME, TestPodFactory.CMD.getValue(), DefaultResourceSet.newBuilder(TestConstants.ROLE, Constants.ANY_ROLE, TestConstants.PRINCIPAL) .id(TestConstants.RESOURCE_SET_ID) .cpus(5.) .memory(6.) .build()); Assert.assertTrue(TaskUtils.areDifferent(oldTaskSpecification, newTaskSpecification)); }
@Test(expected=IllegalArgumentException.class) public void testConfigsSameNameFailsValidation() { TestPodFactory.getTaskSpec( TestConstants.TASK_NAME, TestPodFactory.CMD.getValue(), TestPodFactory.getResourceSet(TestConstants.RESOURCE_SET_ID, 1, 2, 3), Arrays.asList( DefaultConfigFileSpec.newBuilder() .name("config") .relativePath("../relative/path/to/config") .templateContent("this is a config template") .build(), DefaultConfigFileSpec.newBuilder() .name("config") .relativePath("../relative/path/to/config2") .templateContent("same name should fail") .build())); }
@Test(expected=IllegalArgumentException.class) public void testConfigsSamePathFailsValidation() { TestPodFactory.getTaskSpec( TestConstants.TASK_NAME, TestPodFactory.CMD.getValue(), TestPodFactory.getResourceSet(TestConstants.RESOURCE_SET_ID, 1, 2, 3), Arrays.asList( DefaultConfigFileSpec.newBuilder() .name("config") .relativePath("../relative/path/to/config") .templateContent("this is a config template") .build(), DefaultConfigFileSpec.newBuilder() .name("config2") .relativePath("../relative/path/to/config") .templateContent("same path should fail") .build())); }
@Test public void testAreDifferentTaskSpecificationsNoResourceOverlap() { TaskSpec oldTaskSpecification = TestPodFactory.getTaskSpec( TestConstants.TASK_NAME, TestPodFactory.CMD.getValue(), DefaultResourceSet.newBuilder(TestConstants.ROLE, Constants.ANY_ROLE, TestConstants.PRINCIPAL) .id(TestConstants.RESOURCE_SET_ID) .cpus(5.) .build()); TaskSpec newTaskSpecification = TestPodFactory.getTaskSpec( TestConstants.TASK_NAME, TestPodFactory.CMD.getValue(), DefaultResourceSet.newBuilder(TestConstants.ROLE, Constants.ANY_ROLE, TestConstants.PRINCIPAL) .id(TestConstants.RESOURCE_SET_ID) .memory(5.) .build()); Assert.assertTrue(TaskUtils.areDifferent(oldTaskSpecification, newTaskSpecification)); }
/** * Gets the command. * * @return The command used to launch the executor. */ public String getCommand() { return info.getCommand().getValue(); }
public static TaskSpec getTaskSpec(String name, String resourceSetId, String dnsPrefix) { return getTaskSpec( name, CMD.getValue(), resourceSetId, dnsPrefix, CPU, MEM, DISK); }
public static TaskSpec getTaskSpec(String name, String resourceSetId) { return getTaskSpec( name, CMD.getValue(), resourceSetId, null, CPU, MEM, DISK); }