Java Code Examples for org.apache.hadoop.yarn.api.records.LocalResourceVisibility#PRIVATE

The following examples show how to use org.apache.hadoop.yarn.api.records.LocalResourceVisibility#PRIVATE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ResourceLocalizationService.java    From hadoop with Apache License 2.0 6 votes vote down vote up
private Path getPathForLocalization(LocalResource rsrc) throws IOException,
    URISyntaxException {
  String user = context.getUser();
  ApplicationId appId =
      context.getContainerId().getApplicationAttemptId().getApplicationId();
  LocalResourceVisibility vis = rsrc.getVisibility();
  LocalResourcesTracker tracker =
      getLocalResourcesTracker(vis, user, appId);
  String cacheDirectory = null;
  if (vis == LocalResourceVisibility.PRIVATE) {// PRIVATE Only
    cacheDirectory = getUserFileCachePath(user);
  } else {// APPLICATION ONLY
    cacheDirectory = getAppFileCachePath(user, appId.toString());
  }
  Path dirPath =
      dirsHandler.getLocalPathForWrite(cacheDirectory,
        ContainerLocalizer.getEstimatedSize(rsrc), false);
  return tracker.getPathForLocalization(new LocalResourceRequest(rsrc),
      dirPath, delService);
}
 
Example 2
Source File: ResourceLocalizationService.java    From big-c with Apache License 2.0 6 votes vote down vote up
private Path getPathForLocalization(LocalResource rsrc) throws IOException,
    URISyntaxException {
  String user = context.getUser();
  ApplicationId appId =
      context.getContainerId().getApplicationAttemptId().getApplicationId();
  LocalResourceVisibility vis = rsrc.getVisibility();
  LocalResourcesTracker tracker =
      getLocalResourcesTracker(vis, user, appId);
  String cacheDirectory = null;
  if (vis == LocalResourceVisibility.PRIVATE) {// PRIVATE Only
    cacheDirectory = getUserFileCachePath(user);
  } else {// APPLICATION ONLY
    cacheDirectory = getAppFileCachePath(user, appId.toString());
  }
  Path dirPath =
      dirsHandler.getLocalPathForWrite(cacheDirectory,
        ContainerLocalizer.getEstimatedSize(rsrc), false);
  return tracker.getPathForLocalization(new LocalResourceRequest(rsrc),
      dirPath);
}
 
Example 3
Source File: DagTypeConverters.java    From incubator-tez with Apache License 2.0 5 votes vote down vote up
public static LocalResourceVisibility convertFromDAGPlan(PlanLocalResourceVisibility visibility){
  switch(visibility){
    case PUBLIC : return LocalResourceVisibility.PUBLIC;
    case PRIVATE : return LocalResourceVisibility.PRIVATE;
    case APPLICATION : return LocalResourceVisibility.APPLICATION;
    default : throw new RuntimeException("unknown 'visibility': " + visibility);
  }
}
 
Example 4
Source File: DagTypeConverters.java    From tez with Apache License 2.0 5 votes vote down vote up
public static LocalResourceVisibility convertFromDAGPlan(PlanLocalResourceVisibility visibility){
  switch(visibility){
    case PUBLIC : return LocalResourceVisibility.PUBLIC;
    case PRIVATE : return LocalResourceVisibility.PRIVATE;
    case APPLICATION : return LocalResourceVisibility.APPLICATION;
    default : throw new RuntimeException("unknown 'visibility': " + visibility);
  }
}