List of usage examples for org.apache.hadoop.yarn.api.records LocalResource setResource
@Public @Stable public abstract void setResource(URL resource);
From source file:yarnkit.utils.YarnUtils.java
License:Apache License
@Nonnull public static LocalResource createLocalResource(@Nonnull FileSystem fs, @Nonnull Path hdfsPath) throws IOException { LocalResource resource = Records.newRecord(LocalResource.class); FileStatus fileStat = fs.getFileStatus(hdfsPath); resource.setResource(ConverterUtils.getYarnUrlFromPath(hdfsPath)); resource.setSize(fileStat.getLen()); resource.setTimestamp(fileStat.getModificationTime()); resource.setType(fileStat.isFile() ? LocalResourceType.FILE : LocalResourceType.ARCHIVE); resource.setVisibility(LocalResourceVisibility.APPLICATION); return resource; }
From source file:yrun.YarnRunner.java
License:Apache License
private void setupAppMasterArgs(Path yarnRunnerArgsPath, LocalResource appMasterArgs) throws IOException { FileSystem fileSystem = yarnRunnerArgsPath.getFileSystem(_configuration); FileStatus jarStatus = fileSystem.getFileStatus(yarnRunnerArgsPath); appMasterArgs.setResource(ConverterUtils.getYarnUrlFromPath(yarnRunnerArgsPath)); appMasterArgs.setSize(jarStatus.getLen()); appMasterArgs.setTimestamp(jarStatus.getModificationTime()); appMasterArgs.setType(LocalResourceType.FILE); appMasterArgs.setVisibility(LocalResourceVisibility.PUBLIC); }
From source file:yrun.YarnRunner.java
License:Apache License
private void setupAppMasterJar(Path jarPath, LocalResource appMasterJar) throws IOException { FileSystem fileSystem = jarPath.getFileSystem(_configuration); FileStatus jarStatus = fileSystem.getFileStatus(jarPath); appMasterJar.setResource(ConverterUtils.getYarnUrlFromPath(jarPath)); appMasterJar.setSize(jarStatus.getLen()); appMasterJar.setTimestamp(jarStatus.getModificationTime()); appMasterJar.setType(LocalResourceType.FILE); appMasterJar.setVisibility(LocalResourceVisibility.PUBLIC); }