org.apache.hadoop.yarn.api.records.Container.getNodeHttpAddress()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(118)

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

Container.getNodeHttpAddress介绍

[英]Get the http uri of the node on which the container is allocated.
[中]获取分配容器的节点的http uri。

代码示例

代码示例来源:origin: Qihoo360/XLearning

for (Container container : workerContainers) {
 Map<String, String> containerMessage = new HashMap<>();
 containerMessage.put(AMParams.CONTAINER_HTTP_ADDRESS, container.getNodeHttpAddress());
 if (tfEvaluator && container.getId().toString().equals(tfEvaluatorContainerId)) {
  containerMessage.put(AMParams.CONTAINER_ROLE, XLearningConstants.EVALUATOR);
   container.getNodeHttpAddress(),
   container.getId().toString(),
   userName));
 containerMessage.put(AMParams.CONTAINER_HTTP_ADDRESS, container.getNodeHttpAddress());
 if (xlearningAppType.equals("TENSORFLOW")) {
  containerMessage.put(AMParams.CONTAINER_ROLE, "ps");
   container.getNodeHttpAddress(),
   container.getId().toString(),
   userName));

代码示例来源:origin: Qihoo360/XLearning

int i = 0;
for (Container container : workerContainers) {
 set(CONTAINER_HTTP_ADDRESS + i, container.getNodeHttpAddress());
 set(CONTAINER_ID + i, container.getId().toString());
 if (app.context.getContainerStatus(new XLearningContainerId(container.getId())) != null) {
 set(CONTAINER_HTTP_ADDRESS + i, container.getNodeHttpAddress());
 set(CONTAINER_ID + i, container.getId().toString());
 if (app.context.getContainerStatus(new XLearningContainerId(container.getId())) != null) {

代码示例来源:origin: alibaba/jstorm

+ ", containerNode=" + allocatedContainer.getNodeId().getHost()
+ ":" + allocatedContainer.getNodeId().getPort()
+ ", containerNodeURI=" + allocatedContainer.getNodeHttpAddress()
+ ", containerResourceMemory"
+ allocatedContainer.getResource().getMemory()

代码示例来源:origin: apache/drill

nmLink = "http://" + task.container.getNodeHttpAddress();
} else {
 memoryMb = task.scheduler.getResource().memoryMb;

代码示例来源:origin: apache/metron

private String containerHostname() {
  String nodeHost = null;
  try {
   boolean hasProtocol = container.getNodeHttpAddress().startsWith("http");
   java.net.URL nodehttpAddress = new java.net.URL((hasProtocol?"":"http://") + container.getNodeHttpAddress());
   nodeHost = nodehttpAddress.getHost();
  } catch (MalformedURLException e) {
   LOG.error(e.getMessage(), e);
   throw new IllegalStateException("Unable to parse " + container.getNodeHttpAddress() + " into a URL");
  }
  return nodeHost;
 }
}

代码示例来源:origin: apache/metron

@Override
public void onContainersAllocated(List<Container> allocatedContainers) {
 LOG.info("Got response from RM for container ask, allocatedCnt="
     + allocatedContainers.size());
 for (Container allocatedContainer : allocatedContainers) {
  containers.put(allocatedContainer.getId(), allocatedContainer);
  state.registerContainer(allocatedContainer.getResource(), allocatedContainer);
  LOG.info("Launching shell command on a new container."
      + ", containerId=" + allocatedContainer.getId()
      + ", containerNode=" + allocatedContainer.getNodeId().getHost()
      + ":" + allocatedContainer.getNodeId().getPort()
      + ", containerNodeURI=" + allocatedContainer.getNodeHttpAddress()
      + ", containerResourceMemory="
      + allocatedContainer.getResource().getMemory()
      + ", containerResourceVirtualCores="
      + allocatedContainer.getResource().getVirtualCores());
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-mapreduce-client-app

/**If container Assigned then return the node's address, otherwise null.
 */
@Override
public String getNodeHttpAddress() {
 readLock.lock();
 try {
  return container == null ? null : container.getNodeHttpAddress();
 } finally {
  readLock.unlock();
 }
}

代码示例来源:origin: io.hops/hadoop-mapreduce-client-app

/**If container Assigned then return the node's address, otherwise null.
 */
@Override
public String getNodeHttpAddress() {
 readLock.lock();
 try {
  return container == null ? null : container.getNodeHttpAddress();
 } finally {
  readLock.unlock();
 }
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-mapreduce-client-app

/**If container Assigned then return the node's address, otherwise null.
 */
@Override
public String getNodeHttpAddress() {
 readLock.lock();
 try {
  return container == null ? null : container.getNodeHttpAddress();
 } finally {
  readLock.unlock();
 }
}

代码示例来源:origin: linkedin/TonY

public static String constructContainerUrl(Container container) {
 try {
  return String.format(WORKER_LOG_URL_TEMPLATE, container.getNodeHttpAddress(), container.getId(),
    UserGroupInformation.getCurrentUser().getShortUserName());
 } catch (IOException e) {
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: apache/incubator-slider

@Override
public Entry<TableContent,String> apply(ClusterNode input) {
 final String containerId = input.name;
 
 if (containerInstances.containsKey(containerId)) {
  RoleInstance roleInst = containerInstances.get(containerId);
  if (roleInst.container.getNodeHttpAddress() != null) {
   return Maps.<TableContent,String> immutableEntry(
    new TableAnchorContent(containerId,
      buildNodeUrlForContainer(roleInst.container.getNodeHttpAddress(), containerId)), null);
  }
 }
 return Maps.immutableEntry(new TableContent(input.name), null);
}

代码示例来源:origin: org.apache.slider/slider-core

@Override
public Entry<TableContent,String> apply(ClusterNode input) {
 final String containerId = input.name;
 
 if (containerInstances.containsKey(containerId)) {
  RoleInstance roleInst = containerInstances.get(containerId);
  if (roleInst.container.getNodeHttpAddress() != null) {
   return Maps.<TableContent,String> immutableEntry(
    new TableAnchorContent(containerId,
      buildNodeUrlForContainer(roleInst.container.getNodeHttpAddress(), containerId)), null);
  }
 }
 return Maps.immutableEntry(new TableContent(input.name), null);
}

代码示例来源:origin: org.apache.hadoop/hadoop-mapreduce-client-app

private static void
  sendJHStartEventForAssignedFailTask(TaskAttemptImpl taskAttempt) {
 if (null == taskAttempt.container) {
  return;
 }
 taskAttempt.launchTime = taskAttempt.clock.getTime();
 InetSocketAddress nodeHttpInetAddr =
   NetUtils.createSocketAddr(taskAttempt.container.getNodeHttpAddress());
 taskAttempt.trackerName = nodeHttpInetAddr.getHostName();
 taskAttempt.httpPort = nodeHttpInetAddr.getPort();
 taskAttempt.sendLaunchedEvents();
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-mapreduce-client-app

private static void
  sendJHStartEventForAssignedFailTask(TaskAttemptImpl taskAttempt) {
 if (null == taskAttempt.container) {
  return;
 }
 taskAttempt.launchTime = taskAttempt.clock.getTime();
 InetSocketAddress nodeHttpInetAddr =
   NetUtils.createSocketAddr(taskAttempt.container.getNodeHttpAddress());
 taskAttempt.trackerName = nodeHttpInetAddr.getHostName();
 taskAttempt.httpPort = nodeHttpInetAddr.getPort();
 taskAttempt.sendLaunchedEvents();
}

代码示例来源:origin: io.hops/hadoop-mapreduce-client-app

private static void
  sendJHStartEventForAssignedFailTask(TaskAttemptImpl taskAttempt) {
 if (null == taskAttempt.container) {
  return;
 }
 taskAttempt.launchTime = taskAttempt.clock.getTime();
 InetSocketAddress nodeHttpInetAddr =
   NetUtils.createSocketAddr(taskAttempt.container.getNodeHttpAddress());
 taskAttempt.trackerName = nodeHttpInetAddr.getHostName();
 taskAttempt.httpPort = nodeHttpInetAddr.getPort();
 taskAttempt.sendLaunchedEvents();
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager

@Override
public String getLogURL() {
 try {
  readLock.lock();
  StringBuilder logURL = new StringBuilder();
  logURL.append(WebAppUtils.getHttpSchemePrefix(rmContext
    .getYarnConfiguration()));
  logURL.append(WebAppUtils.getRunningLogURL(
    container.getNodeHttpAddress(), ConverterUtils.toString(containerId),
    user));
  return logURL.toString();
 } finally {
  readLock.unlock();
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

@Override
public String getLogURL() {
 try {
  readLock.lock();
  StringBuilder logURL = new StringBuilder();
  logURL.append(WebAppUtils.getHttpSchemePrefix(rmContext
    .getYarnConfiguration()));
  logURL.append(WebAppUtils.getRunningLogURL(
    container.getNodeHttpAddress(), ConverterUtils.toString(containerId),
    user));
  return logURL.toString();
 } finally {
  readLock.unlock();
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

@Override
public String getLogURL() {
 try {
  readLock.lock();
  StringBuilder logURL = new StringBuilder();
  logURL.append(WebAppUtils.getHttpSchemePrefix(rmContext
    .getYarnConfiguration()));
  logURL.append(WebAppUtils.getRunningLogURL(
    container.getNodeHttpAddress(), getContainerId().toString(),
    user));
  return logURL.toString();
 } finally {
  readLock.unlock();
 }
}

代码示例来源:origin: org.apache.slider/slider-core

public static String containerToString(Container container) {
 if (container == null) {
  return "null container";
 }
 return String.format(Locale.ENGLISH,
   "ContainerID=%s nodeID=%s http=%s priority=%s resource=%s",
   container.getId(),
   container.getNodeId(),
   container.getNodeHttpAddress(),
   container.getPriority(),
   container.getResource());
}

代码示例来源:origin: apache/incubator-slider

public static String containerToString(Container container) {
 if (container == null) {
  return "null container";
 }
 return String.format(Locale.ENGLISH,
   "ContainerID=%s nodeID=%s http=%s priority=%s resource=%s",
   container.getId(),
   container.getNodeId(),
   container.getNodeHttpAddress(),
   container.getPriority(),
   container.getResource());
}

相关文章