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

The following examples show how to use org.apache.hadoop.yarn.api.records.LocalResource#getTimestamp() . 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: GlobalJarUploader.java    From reef with Apache License 2.0 6 votes vote down vote up
/**
 * Creates the JAR file with the global files on the driver and then uploads it to the job folder on
 * (H)DFS.
 *
 * @return the map to be used as the "global" resources when submitting Evaluators.
 * @throws IOException if the creation of the JAR or the upload fails
 */
@Override
public synchronized Map<String, LocalResource> call() throws IOException {
  final Map<String, LocalResource> globalResources = new HashMap<>(1);
  if (!this.isUploaded){
    this.pathToGlobalJar = this.uploader.uploadToJobFolder(makeGlobalJar());
    this.isUploaded = true;
  }

  final LocalResource updatedGlobalJarResource = this.uploader.makeLocalResourceForJarFile(this.pathToGlobalJar);

  if (this.globalJarResource != null
      && this.globalJarResource.getTimestamp() != updatedGlobalJarResource.getTimestamp()) {
    LOG.log(Level.WARNING,
            "The global JAR LocalResource timestamp has been changed from "
            + this.globalJarResource.getTimestamp() + " to " + updatedGlobalJarResource.getTimestamp());
  }

  this.globalJarResource = updatedGlobalJarResource;

  // For now, always rewrite the information due to REEF-348
  globalResources.put(this.fileNames.getGlobalFolderPath(), updatedGlobalJarResource);

  return globalResources;
}
 
Example 2
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 3
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());
}
 
Example 4
Source File: TezConverterUtils.java    From incubator-tez with Apache License 2.0 4 votes vote down vote up
@Private
public static TezLocalResource convertYarnLocalResourceToTez(LocalResource lr)
    throws URISyntaxException {
  return new TezLocalResource(getURIFromYarnURL(lr.getResource()), lr.getSize(),
      lr.getTimestamp());
}
 
Example 5
Source File: TezConverterUtils.java    From tez with Apache License 2.0 4 votes vote down vote up
@Private
public static TezLocalResource convertYarnLocalResourceToTez(LocalResource lr)
    throws URISyntaxException {
  return new TezLocalResource(getURIFromYarnURL(lr.getResource()), lr.getSize(),
      lr.getTimestamp());
}