use of com.twitter.heron.api.generated.TopologyAPI.Topology in project heron by twitter.
the class HeronExecutorTask method getExecutorCommand.
String[] getExecutorCommand() {
String topologyDefFile = getTopologyDefnFile();
Topology topology = getTopology(topologyDefFile);
Config config = SchedulerConfigUtils.loadConfig(cluster, role, env, topologyJar, topologyDefFile, verboseMode, topology);
List<Integer> freePorts = new ArrayList<>(SchedulerUtils.PORTS_REQUIRED_FOR_EXECUTOR);
for (int i = 0; i < SchedulerUtils.PORTS_REQUIRED_FOR_EXECUTOR; i++) {
freePorts.add(SysUtils.getFreePort());
}
Config runtime = Config.newBuilder().put(Key.COMPONENT_RAMMAP, componentRamMap).put(Key.TOPOLOGY_DEFINITION, topology).build();
String[] executorCmd = SchedulerUtils.executorCommand(config, runtime, heronExecutorId, freePorts);
LOG.info("Executor command line: " + Arrays.toString(executorCmd));
return executorCmd;
}
use of com.twitter.heron.api.generated.TopologyAPI.Topology in project heron by twitter.
the class HeronExecutorTaskTest method providesConfigsNeededForExecutorCmd.
@Test
public void providesConfigsNeededForExecutorCmd() throws Exception {
Topology testTopology = createTestTopology("testTopology");
HeronExecutorTask spyTask = getSpyOnHeronExecutorTask(null);
Mockito.doReturn("file").when(spyTask).getTopologyDefnFile();
Mockito.doReturn(testTopology).when(spyTask).getTopology("file");
String[] command = spyTask.getExecutorCommand();
// only two configs; state manager root and url should be null.
int nullCounter = 2;
for (String subCommand : command) {
if (subCommand == null) {
nullCounter--;
}
}
Assert.assertEquals(0, nullCounter);
}
Aggregations