use of org.apache.flink.kubernetes.kubeclient.parameters.KubernetesTaskManagerParameters in project flink by apache.
the class KubernetesResourceManagerDriver method requestResource.
@Override
public CompletableFuture<KubernetesWorkerNode> requestResource(TaskExecutorProcessSpec taskExecutorProcessSpec) {
final KubernetesTaskManagerParameters parameters = createKubernetesTaskManagerParameters(taskExecutorProcessSpec);
final KubernetesPod taskManagerPod = KubernetesTaskManagerFactory.buildTaskManagerKubernetesPod(taskManagerPodTemplate, parameters);
final String podName = taskManagerPod.getName();
final CompletableFuture<KubernetesWorkerNode> requestResourceFuture = new CompletableFuture<>();
requestResourceFutures.put(podName, requestResourceFuture);
log.info("Creating new TaskManager pod with name {} and resource <{},{}>.", podName, parameters.getTaskManagerMemoryMB(), parameters.getTaskManagerCPU());
final CompletableFuture<Void> createPodFuture = flinkKubeClient.createTaskManagerPod(taskManagerPod);
FutureUtils.assertNoException(createPodFuture.handleAsync((ignore, exception) -> {
if (exception != null) {
log.warn("Could not create pod {}, exception: {}", podName, exception);
CompletableFuture<KubernetesWorkerNode> future = requestResourceFutures.remove(taskManagerPod.getName());
if (future != null) {
future.completeExceptionally(exception);
}
} else {
log.info("Pod {} is created.", podName);
}
return null;
}, getMainThreadExecutor()));
return requestResourceFuture;
}
use of org.apache.flink.kubernetes.kubeclient.parameters.KubernetesTaskManagerParameters in project flink by apache.
the class InitTaskManagerDecoratorWithPodTemplateTest method getResultPod.
@Override
public FlinkPod getResultPod(FlinkPod podTemplate) {
final KubernetesTaskManagerParameters kubernetesTaskManagerParameters = KubernetesTestUtils.createTaskManagerParameters(flinkConfig, POD_NAME);
final InitTaskManagerDecorator initTaskManagerDecorator = new InitTaskManagerDecorator(kubernetesTaskManagerParameters);
return initTaskManagerDecorator.decorateFlinkPod(podTemplate);
}
use of org.apache.flink.kubernetes.kubeclient.parameters.KubernetesTaskManagerParameters in project flink by apache.
the class KubernetesTaskManagerTestBase method onSetup.
@Override
protected void onSetup() throws Exception {
taskExecutorProcessSpec = TaskExecutorProcessUtils.processSpecFromConfig(flinkConfig);
containeredTaskManagerParameters = ContaineredTaskManagerParameters.create(flinkConfig, taskExecutorProcessSpec);
kubernetesTaskManagerParameters = new KubernetesTaskManagerParameters(flinkConfig, POD_NAME, DYNAMIC_PROPERTIES, JVM_MEM_OPTS_ENV, containeredTaskManagerParameters, ExternalResourceUtils.getExternalResourceConfigurationKeys(flinkConfig, KubernetesConfigOptions.EXTERNAL_RESOURCE_KUBERNETES_CONFIG_KEY_SUFFIX));
}
use of org.apache.flink.kubernetes.kubeclient.parameters.KubernetesTaskManagerParameters in project flink by apache.
the class KubernetesResourceManagerDriver method createKubernetesTaskManagerParameters.
private KubernetesTaskManagerParameters createKubernetesTaskManagerParameters(TaskExecutorProcessSpec taskExecutorProcessSpec) {
final String podName = String.format(TASK_MANAGER_POD_FORMAT, clusterId, currentMaxAttemptId, ++currentMaxPodId);
final ContaineredTaskManagerParameters taskManagerParameters = ContaineredTaskManagerParameters.create(flinkConfig, taskExecutorProcessSpec);
final Configuration taskManagerConfig = new Configuration(flinkConfig);
taskManagerConfig.set(TaskManagerOptions.TASK_MANAGER_RESOURCE_ID, podName);
final String dynamicProperties = BootstrapTools.getDynamicPropertiesAsString(flinkClientConfig, taskManagerConfig);
final String jvmMemOpts = ProcessMemoryUtils.generateJvmParametersStr(taskExecutorProcessSpec);
return new KubernetesTaskManagerParameters(flinkConfig, podName, dynamicProperties, jvmMemOpts, taskManagerParameters, ExternalResourceUtils.getExternalResourceConfigurationKeys(flinkConfig, KubernetesConfigOptions.EXTERNAL_RESOURCE_KUBERNETES_CONFIG_KEY_SUFFIX));
}
Aggregations