Example usage for org.apache.hadoop.fs FileStatus getModificationTime

List of usage examples for org.apache.hadoop.fs FileStatus getModificationTime

Introduction

In this page you can find the example usage for org.apache.hadoop.fs FileStatus getModificationTime.

Prototype

public long getModificationTime() 

Source Link

Document

Get the modification time of the file.

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

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