Example usage for org.apache.hadoop.conf Configuration get

List of usage examples for org.apache.hadoop.conf Configuration get

Introduction

In this page you can find the example usage for org.apache.hadoop.conf Configuration get.

Prototype

public String get(String name) 

Source Link

Document

Get the value of the name property, null if no such property exists.

Usage

From source file:be.ugent.intec.halvade.utils.HalvadeConf.java

License:Open Source License

public static String[] getKnownSitesOnHDFS(Configuration conf) {
    int size = conf.getInt(numberOfSites, 0);
    String[] sites = new String[size];
    for (int i = 0; i < size; i++) {
        sites[i] = conf.get(sitesOnHDFSName + i);
    }//ww w .  j  a  v a  2 s  . co m
    return sites;
}

From source file:be.ugent.intec.halvade.utils.HalvadeConf.java

License:Open Source License

public static void clearTaskFiles(Configuration conf) throws IOException, URISyntaxException {
    String filepath = conf.get(outdir) + tasksDone;
    FileSystem fs = FileSystem.get(new URI(filepath), conf);
    fs.delete(new Path(filepath), true);
}

From source file:be.ugent.intec.halvade.utils.HalvadeConf.java

License:Open Source License

public static boolean addTaskRunning(Configuration conf, String val) throws IOException, URISyntaxException {
    val = val.substring(0, val.lastIndexOf("_")); // rewrite file if second attempt
    String filepath = conf.get(outdir) + tasksDone + val;
    FileSystem fs = FileSystem.get(new URI(filepath), conf);
    return fs.createNewFile(new Path(filepath));
}

From source file:be.ugent.intec.halvade.utils.HalvadeConf.java

License:Open Source License

public static int getMapTasksLeft(Configuration conf) throws IOException, URISyntaxException {
    int containers = conf.getInt(totalContainers, 1);
    int tasks = 0;
    String filedir = conf.get(outdir) + tasksDone;
    FileSystem fs = FileSystem.get(new URI(filedir), conf);
    FileStatus[] files = fs.listStatus(new Path(filedir));
    for (FileStatus file : files) {
        if (!file.isDirectory()) {
            tasks++;/*from w  ww  .j  a va 2 s  .c o m*/
        }
    }
    Logger.DEBUG("containers left: " + (Integer.parseInt(conf.get("mapred.map.tasks")) - tasks));
    return Integer.parseInt(conf.get("mapred.map.tasks")) - tasks;
}

From source file:be.ugent.intec.halvade.utils.HalvadeConf.java

License:Open Source License

public static boolean allTasksCompleted(Configuration conf) throws IOException, URISyntaxException {
    int tasks = 0;
    String filedir = conf.get(outdir) + tasksDone;
    FileSystem fs = FileSystem.get(new URI(filedir), conf);
    FileStatus[] files = fs.listStatus(new Path(filedir));
    for (FileStatus file : files) {
        if (!file.isDirectory()) {
            tasks++;/* w ww  .jav a2 s  .  c  o m*/
        }
    }
    Logger.DEBUG("tasks started: " + tasks);
    return tasks >= Integer.parseInt(conf.get("mapred.map.tasks"));
}

From source file:be.ugent.intec.halvade.utils.HalvadeConf.java

License:Open Source License

public static String getRefOnHDFS(Configuration conf) {
    return conf.get(refOnHDFSName);
}

From source file:be.ugent.intec.halvade.utils.HalvadeConf.java

License:Open Source License

public static String getStarDirOnHDFS(Configuration conf) {
    return conf.get(starDirOnHDFSName);
}

From source file:be.ugent.intec.halvade.utils.HalvadeConf.java

License:Open Source License

public static String getStarDirPass2HDFS(Configuration conf) {
    return conf.get(starDirPass2HDFSName);
}

From source file:be.ugent.intec.halvade.utils.HalvadeConf.java

License:Open Source License

public static int getNumberOfFiles(Configuration conf) {
    return Integer.parseInt(conf.get("mapred.map.tasks"));
}

From source file:be.ugent.intec.halvade.utils.HalvadeConf.java

License:Open Source License

public static SAMSequenceDictionary getSequenceDictionary(Configuration conf) throws IOException {
    int counter = conf.getInt(dictionaryCount, 0);
    SAMSequenceDictionary dict = new SAMSequenceDictionary();
    for (int i = 0; i < counter; i++) {
        String seqName = conf.get(dictionarySequenceName + i);
        int seqLength = conf.getInt(dictionarySequenceLength + i, 0);
        SAMSequenceRecord seq = new SAMSequenceRecord(seqName, seqLength);
        dict.addSequence(seq);//ww w  .  j ava  2 s  .  co  m
    }
    return dict;
}