Java Code Examples for org.apache.hadoop.fs.FileSystem#getAllStatistics()

The following examples show how to use org.apache.hadoop.fs.FileSystem#getAllStatistics() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: hadoop   File: Task.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Gets a handle to the Statistics instance based on the scheme associated
 * with path.
 * 
 * @param path the path.
 * @param conf the configuration to extract the scheme from if not part of 
 *   the path.
 * @return a Statistics instance, or null if none is found for the scheme.
 */
protected static List<Statistics> getFsStatistics(Path path, Configuration conf) throws IOException {
  List<Statistics> matchedStats = new ArrayList<FileSystem.Statistics>();
  path = path.getFileSystem(conf).makeQualified(path);
  String scheme = path.toUri().getScheme();
  for (Statistics stats : FileSystem.getAllStatistics()) {
    if (stats.getScheme().equals(scheme)) {
      matchedStats.add(stats);
    }
  }
  return matchedStats;
}
 
Example 2
Source Project: big-c   File: Task.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Gets a handle to the Statistics instance based on the scheme associated
 * with path.
 * 
 * @param path the path.
 * @param conf the configuration to extract the scheme from if not part of 
 *   the path.
 * @return a Statistics instance, or null if none is found for the scheme.
 */
protected static List<Statistics> getFsStatistics(Path path, Configuration conf) throws IOException {
  List<Statistics> matchedStats = new ArrayList<FileSystem.Statistics>();
  path = path.getFileSystem(conf).makeQualified(path);
  String scheme = path.toUri().getScheme();
  for (Statistics stats : FileSystem.getAllStatistics()) {
    if (stats.getScheme().equals(scheme)) {
      matchedStats.add(stats);
    }
  }
  return matchedStats;
}
 
Example 3
Source Project: RDFS   File: Task.java    License: Apache License 2.0 5 votes vote down vote up
private synchronized void updateCounters() {
  for(Statistics stat: FileSystem.getAllStatistics()) {
    String uriScheme = stat.getScheme();
    FileSystemStatisticUpdater updater = statisticUpdaters.get(uriScheme);
    if(updater==null) {//new FileSystem has been found in the cache
      updater = new FileSystemStatisticUpdater(uriScheme, stat);
      statisticUpdaters.put(uriScheme, updater);
    }
    updater.updateCounters();      
  }
  updateResourceCounters();
}
 
Example 4
Source Project: incubator-tez   File: MRTask.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Gets a handle to the Statistics instance based on the scheme associated
 * with path.
 *
 * @param path the path.
 * @param conf the configuration to extract the scheme from if not part of
 *   the path.
 * @return a Statistics instance, or null if none is found for the scheme.
 */
@Private
public static List<Statistics> getFsStatistics(Path path, Configuration conf) throws IOException {
  List<Statistics> matchedStats = new ArrayList<FileSystem.Statistics>();
  path = path.getFileSystem(conf).makeQualified(path);
  String scheme = path.toUri().getScheme();
  for (Statistics stats : FileSystem.getAllStatistics()) {
    if (stats.getScheme().equals(scheme)) {
      matchedStats.add(stats);
    }
  }
  return matchedStats;
}
 
Example 5
Source Project: incubator-tez   File: Utils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Gets a handle to the Statistics instance based on the scheme associated
 * with path.
 *
 * @param path the path.
 * @param conf the configuration to extract the scheme from if not part of
 *   the path.
 * @return a Statistics instance, or null if none is found for the scheme.
 */
@Private
public static List<Statistics> getFsStatistics(Path path, Configuration conf) throws IOException {
  List<Statistics> matchedStats = new ArrayList<FileSystem.Statistics>();
  path = path.getFileSystem(conf).makeQualified(path);
  String scheme = path.toUri().getScheme();
  for (Statistics stats : FileSystem.getAllStatistics()) {
    if (stats.getScheme().equals(scheme)) {
      matchedStats.add(stats);
    }
  }
  return matchedStats;
}
 
Example 6
Source Project: tez   File: Utils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Gets a handle to the Statistics instance based on the scheme associated
 * with path.
 *
 * @param path the path.
 * @param conf the configuration to extract the scheme from if not part of
 *   the path.
 * @return a Statistics instance, or null if none is found for the scheme.
 */
@Private
public static List<Statistics> getFsStatistics(Path path, Configuration conf) throws IOException {
  List<Statistics> matchedStats = new ArrayList<FileSystem.Statistics>();
  path = path.getFileSystem(conf).makeQualified(path);
  String scheme = path.toUri().getScheme();
  for (Statistics stats : FileSystem.getAllStatistics()) {
    if (stats.getScheme().equals(scheme)) {
      matchedStats.add(stats);
    }
  }
  return matchedStats;
}
 
Example 7
Source Project: hadoop-gpu   File: Task.java    License: Apache License 2.0 5 votes vote down vote up
private synchronized void updateCounters() {
  for(Statistics stat: FileSystem.getAllStatistics()) {
    String uriScheme = stat.getScheme();
    FileSystemStatisticUpdater updater = statisticUpdaters.get(uriScheme);
    if(updater==null) {//new FileSystem has been found in the cache
      updater = new FileSystemStatisticUpdater(uriScheme, stat);
      statisticUpdaters.put(uriScheme, updater);
    }
    updater.updateCounters();      
  }
}