use of io.kubernetes.client.openapi.Configuration in project heron by twitter.
the class V1Controller method getExecutorCommand.
/**
* Generates the command to start Heron within the <code>container</code>.
* @param containerId Passed down to <>SchedulerUtils</> to generate executor command.
* @param numOfInstances Used to configure the debugging ports.
* @param isExecutor Flag used to generate the correct <code>shard_id</code>.
* @return The complete command to start Heron in a <code>container</code>.
*/
protected List<String> getExecutorCommand(String containerId, int numOfInstances, boolean isExecutor) {
final Config configuration = getConfiguration();
final Config runtimeConfiguration = getRuntimeConfiguration();
final Map<ExecutorPort, String> ports = KubernetesConstants.EXECUTOR_PORTS.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().toString()));
if (TopologyUtils.getTopologyRemoteDebuggingEnabled(Runtime.topology(runtimeConfiguration)) && numOfInstances != 0) {
List<String> remoteDebuggingPorts = new LinkedList<>();
IntStream.range(0, numOfInstances).forEach(i -> {
int port = KubernetesConstants.JVM_REMOTE_DEBUGGER_PORT + i;
remoteDebuggingPorts.add(String.valueOf(port));
});
ports.put(ExecutorPort.JVM_REMOTE_DEBUGGER_PORTS, String.join(",", remoteDebuggingPorts));
}
final String[] executorCommand = SchedulerUtils.getExecutorCommand(configuration, runtimeConfiguration, containerId, ports);
return Arrays.asList("sh", "-c", KubernetesUtils.getConfCommand(configuration) + " && " + KubernetesUtils.getFetchCommand(configuration, runtimeConfiguration) + " && " + setShardIdEnvironmentVariableCommand(isExecutor) + " && " + String.join(" ", executorCommand));
}
Aggregations