gpt4 book ai didi

org.apache.samza.job.yarn.YarnClusterResourceManager.runContainer()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 00:47:31 31 4
gpt4 key购买 nike

本文整理了Java中org.apache.samza.job.yarn.YarnClusterResourceManager.runContainer()方法的一些代码示例,展示了YarnClusterResourceManager.runContainer()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YarnClusterResourceManager.runContainer()方法的具体详情如下:
包路径:org.apache.samza.job.yarn.YarnClusterResourceManager
类名称:YarnClusterResourceManager
方法名:runContainer

YarnClusterResourceManager.runContainer介绍

[英]Runs a process as specified by the command builder on the container.
[中]在容器上运行命令生成器指定的进程。

代码示例

代码示例来源:origin: org.apache.samza/samza-yarn

/**
 *
 * Requests the launch of a StreamProcessor with the specified ID on the resource
 * @param resource , the SamzaResource on which to launch the StreamProcessor
 * @param builder, the builder to build the resource launch command from
 *
 * TODO: Support non-builder methods to launch resources. Maybe, refactor into a ContainerLaunchStrategy interface
 */
@Override
public void launchStreamProcessor(SamzaResource resource, CommandBuilder builder) {
 String containerIDStr = builder.buildEnvironment().get(ShellCommandConfig.ENV_CONTAINER_ID());
 log.info("Received launch request for {} on hostname {}", containerIDStr, resource.getHost());
 synchronized (lock) {
  try {
   Container container = allocatedResources.get(resource);
   if (container == null) {
    log.info("Resource {} already released. ", resource);
    return;
   }
   runContainer(containerIDStr, container, builder);
  } catch (Throwable t) {
   log.error("Error in launching stream processor:", t);
   clusterManagerCallback.onStreamProcessorLaunchFailure(resource, t);
  }
 }
}

代码示例来源:origin: org.apache.samza/samza-yarn_2.11

/**
 *
 * Requests the launch of a StreamProcessor with the specified ID on the resource
 * @param resource , the SamzaResource on which to launch the StreamProcessor
 * @param builder, the builder to build the resource launch command from
 *
 * TODO: Support non-builder methods to launch resources. Maybe, refactor into a ContainerLaunchStrategy interface
 */
@Override
public void launchStreamProcessor(SamzaResource resource, CommandBuilder builder) {
 String containerIDStr = builder.buildEnvironment().get(ShellCommandConfig.ENV_CONTAINER_ID());
 log.info("Received launch request for {} on hostname {}", containerIDStr, resource.getHost());
 synchronized (lock) {
  try {
   Container container = allocatedResources.get(resource);
   if (container == null) {
    log.info("Resource {} already released. ", resource);
    return;
   }
   runContainer(containerIDStr, container, builder);
  } catch (Throwable t) {
   log.error("Error in launching stream processor:", t);
   clusterManagerCallback.onStreamProcessorLaunchFailure(resource, t);
  }
 }
}

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com