Java Code Examples for org.apache.hadoop.yarn.api.records.LocalResource#getVisibility()

The following examples show how to use org.apache.hadoop.yarn.api.records.LocalResource#getVisibility() . 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: LocalResourceRequest.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * Wrap API resource to match against cache of localized resources.
 * @param resource Resource requested by container
 * @throws URISyntaxException If the path is malformed
 */
public LocalResourceRequest(LocalResource resource)
    throws URISyntaxException {
  this(ConverterUtils.getPathFromYarnURL(resource.getResource()),
      resource.getTimestamp(),
      resource.getType(),
      resource.getVisibility(),
      resource.getPattern());
}
 
Example 4
Source File: LocalResourceRequest.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * Wrap API resource to match against cache of localized resources.
 * @param resource Resource requested by container
 * @throws URISyntaxException If the path is malformed
 */
public LocalResourceRequest(LocalResource resource)
    throws URISyntaxException {
  this(ConverterUtils.getPathFromYarnURL(resource.getResource()),
      resource.getTimestamp(),
      resource.getType(),
      resource.getVisibility(),
      resource.getPattern());
}