use of com.hashicorp.nomad.apimodel.TaskGroup in project heron by twitter.
the class NomadSchedulerTest method testGetTaskGroup.
@Test
public void testGetTaskGroup() {
Set<PackingPlan.ContainerPlan> containers = new HashSet<>();
containers.add(Mockito.mock(PackingPlan.ContainerPlan.class));
Resource resource = new Resource(CPU_RESOURCE, MEMORY_RESOURCE, DISK_RESOURCE);
PackingPlan.ContainerPlan containerPlan = new PackingPlan.ContainerPlan(CONTAINER_INDEX, new HashSet<>(), Mockito.mock(Resource.class));
scheduler.initialize(this.mockConfig, this.mockRuntime);
Mockito.doReturn(new Task()).when(scheduler).getTask(Mockito.anyString(), Mockito.anyInt(), Mockito.any());
TaskGroup taskGroup = scheduler.getTaskGroup(GROUP_NAME, CONTAINER_INDEX, resource);
LOG.info("taskGroup: " + taskGroup);
Assert.assertEquals(GROUP_NAME, taskGroup.getName());
Assert.assertNotNull(taskGroup.getCount());
Assert.assertNotNull(taskGroup.getTasks());
}
use of com.hashicorp.nomad.apimodel.TaskGroup in project twister2 by DSC-SPIDAL.
the class NomadController method getTaskGroup.
private TaskGroup getTaskGroup(JobAPI.Job job) {
TaskGroup taskGroup = new TaskGroup();
if (JobMasterContext.jobMasterRunsInClient(config)) {
taskGroup.setCount(job.getNumberOfWorkers());
} else {
taskGroup.setCount(job.getNumberOfWorkers() + 1);
}
taskGroup.setName(job.getJobId());
taskGroup.addTasks(getShellDriver(job));
return taskGroup;
}
Aggregations