Example usage for org.apache.hadoop.yarn.api.records LocalResourceVisibility APPLICATION

List of usage examples for org.apache.hadoop.yarn.api.records LocalResourceVisibility APPLICATION

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.api.records LocalResourceVisibility APPLICATION.

Prototype

LocalResourceVisibility APPLICATION

To view the source code for org.apache.hadoop.yarn.api.records LocalResourceVisibility APPLICATION.

Click Source Link

Document

Shared only among containers of the same application on the node.

Usage

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;
}