List of usage examples for org.apache.hadoop.yarn.api.records LocalResource setVisibility
@Public @Stable public abstract void setVisibility(LocalResourceVisibility visibility);
LocalResourceVisibility
of the resource to be localized. From source file:yarnkit.config.hocon.HoconConfig.java
License:Apache License
@Override public void setupLocalResources(@Nonnull FileSystem fs, @Nonnull Path appDir, @Nonnull String path, @Nonnull Map<String, LocalResource> resourceMap) throws IOException { if (!conf.hasPath(path)) { return;//from w w w . ja v a 2 s . co m } List<? extends Config> list = conf.getConfigList(path); if (list.isEmpty()) { return; } for (Config cfg : list) { String name = cfg.getString(TAG_NAME); String file = cfg.getString(TAG_FILE); LocalResource resource = YarnUtils.mapLocalResourceToHDFS(fs, file, appDir, name, resourceMap); if (cfg.hasPath(TAG_VISIBILITY)) { String visibility = cfg.getString(TAG_VISIBILITY).toUpperCase(); resource.setVisibility(LocalResourceVisibility.valueOf(visibility)); } } }
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); }