public static void addFileAsLocalResource(FileSystem fs, Path destFilePath, LocalResourceType resourceType,
      Map<String, LocalResource> resourceMap) throws IOException {
    LocalResource fileResource = Records.newRecord(LocalResource.class);
    FileStatus fileStatus = fs.getFileStatus(destFilePath);
    fileResource.setResource(ConverterUtils.getYarnUrlFromPath(destFilePath));
    fileResource.setSize(fileStatus.getLen());
    fileResource.setTimestamp(fileStatus.getModificationTime());
    fileResource.setType(resourceType);
    fileResource.setVisibility(LocalResourceVisibility.APPLICATION);
    resourceMap.put(destFilePath.getName(), fileResource);
  }
public static void addFileAsLocalResource ( FileSystem fs , Path destFilePath , LocalResourceType resourceType , Map < String , LocalResource > resourceMap ) throws IOException { LocalResource fileResource = Records . newRecord ( LocalResource . class ) ; FileStatus fileStatus = fs . getFileStatus ( destFilePath ) ; fileResource . setResource ( ConverterUtils . getYarnUrlFromPath ( destFilePath ) ) ; fileResource . setSize ( fileStatus . getLen ( ) ) ; fileResource . setTimestamp ( fileStatus . getModificationTime ( ) ) ; fileResource . setType ( resourceType ) ; fileResource . setVisibility ( LocalResourceVisibility . APPLICATION ) ; resourceMap . put ( destFilePath . getName ( ) , fileResource ) ; }
Add a file as a Yarn {@link org.apache.hadoop.yarn.api.records.LocalResource}.

@param fs a {@link FileSystem} instance
@param destFilePath the destination file path
@param resourceType the {@link org.apache.hadoop.yarn.api.records.LocalResourceType} of the file
@param resourceMap a {@link Map} of file names to their corresponding
{@link org.apache.hadoop.yarn.api.records.LocalResource}s
@throws IOException if there's something wrong adding the file as a
{@link org.apache.hadoop.yarn.api.records.LocalResource}