当前位置: 首页>>代码示例>>Java>>正文


Java ResourceEvent.getLocalResourceRequest方法代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.event.ResourceEvent.getLocalResourceRequest方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceEvent.getLocalResourceRequest方法的具体用法?Java ResourceEvent.getLocalResourceRequest怎么用?Java ResourceEvent.getLocalResourceRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.event.ResourceEvent的用法示例。


在下文中一共展示了ResourceEvent.getLocalResourceRequest方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handle

import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.event.ResourceEvent; //导入方法依赖的package包/类
@Override
public synchronized void handle(ResourceEvent event) {
  LocalResourceRequest req = event.getLocalResourceRequest();
  LocalizedResource rsrc = localrsrc.get(req);
  switch (event.getType()) {
  case LOCALIZED:
    if (useLocalCacheDirectoryManager) {
      inProgressLocalResourcesMap.remove(req);
    }
    break;
  case REQUEST:
    if (rsrc != null && (!isResourcePresent(rsrc))) {
      LOG.info("Resource " + rsrc.getLocalPath()
          + " is missing, localizing it again");
      removeResource(req);
      rsrc = null;
    }
    if (null == rsrc) {
      rsrc = new LocalizedResource(req, dispatcher);
      localrsrc.put(req, rsrc);
    }
    break;
  case RELEASE:
    if (null == rsrc) {
      // The container sent a release event on a resource which 
      // 1) Failed
      // 2) Removed for some reason (ex. disk is no longer accessible)
      ResourceReleaseEvent relEvent = (ResourceReleaseEvent) event;
      LOG.info("Container " + relEvent.getContainer()
          + " sent RELEASE event on a resource request " + req
          + " not present in cache.");
      return;
    }
    break;
  case LOCALIZATION_FAILED:
    /*
     * If resource localization fails then Localized resource will be
     * removed from local cache.
     */
    removeResource(req);
    break;
  case RECOVERED:
    if (rsrc != null) {
      LOG.warn("Ignoring attempt to recover existing resource " + rsrc);
      return;
    }
    rsrc = recoverResource(req, (ResourceRecoveredEvent) event);
    localrsrc.put(req, rsrc);
    break;
  }

  rsrc.handle(event);

  if (event.getType() == ResourceEventType.LOCALIZED) {
    if (rsrc.getLocalPath() != null) {
      try {
        stateStore.finishResourceLocalization(user, appId,
            buildLocalizedResourceProto(rsrc));
      } catch (IOException ioe) {
        LOG.error("Error storing resource state for " + rsrc, ioe);
      }
    } else {
      LOG.warn("Resource " + rsrc + " localized without a location");
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:67,代码来源:LocalResourcesTrackerImpl.java

示例2: handle

import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.event.ResourceEvent; //导入方法依赖的package包/类
@Override
public synchronized void handle(ResourceEvent event) {
  LocalResourceRequest req = event.getLocalResourceRequest();
  LocalizedResource rsrc = localrsrc.get(req);
  switch (event.getType()) {
  case LOCALIZED:
    if (useLocalCacheDirectoryManager) {
      inProgressLocalResourcesMap.remove(req);
    }
    break;
  case REQUEST:
    if (rsrc != null && (!isResourcePresent(rsrc))) {
      LOG.info("Resource " + rsrc.getLocalPath()
          + " is missing, localizing it again");
      localrsrc.remove(req);
      decrementFileCountForLocalCacheDirectory(req, rsrc);
      rsrc = null;
    }
    if (null == rsrc) {
      rsrc = new LocalizedResource(req, dispatcher);
      localrsrc.put(req, rsrc);
    }
    break;
  case RELEASE:
    if (null == rsrc) {
      // The container sent a release event on a resource which 
      // 1) Failed
      // 2) Removed for some reason (ex. disk is no longer accessible)
      ResourceReleaseEvent relEvent = (ResourceReleaseEvent) event;
      LOG.info("Container " + relEvent.getContainer()
          + " sent RELEASE event on a resource request " + req
          + " not present in cache.");
      return;
    }
    break;
  case LOCALIZATION_FAILED:
    decrementFileCountForLocalCacheDirectory(req, null);
    /*
     * If resource localization fails then Localized resource will be
     * removed from local cache.
     */
    localrsrc.remove(req);
    break;
  }
  rsrc.handle(event);
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:47,代码来源:LocalResourcesTrackerImpl.java


注:本文中的org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.event.ResourceEvent.getLocalResourceRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。