Example usage for org.apache.hadoop.util ProgramDriver driver

List of usage examples for org.apache.hadoop.util ProgramDriver driver

Introduction

In this page you can find the example usage for org.apache.hadoop.util ProgramDriver driver.

Prototype

public void driver(String[] argv) throws Throwable 

Source Link

Document

API compatible with Hadoop 1.x

Usage

From source file:edu.uci.ics.fuzzyjoin.hadoop.FuzzyJoinDriver.java

License:Apache License

public static void main(String argv[]) {
    int exitCode = -1;
    ProgramDriver pgd = new ProgramDriver();
    try {/*from  ww  w.  j  av  a2 s.c  o  m*/
        pgd.addClass("dummyjob", DummyJob.class, "");
        pgd.addClass("recordbuild", RecordBuild.class, "");
        pgd.addClass("fuzzyjoin", FuzzyJoin.class, "");
        pgd.addClass("tokensbasic", TokensBasic.class, "");
        pgd.addClass("tokensimproved", TokensImproved.class, "");
        // pgd.addClass("ridpairsbasic", RIDPairsBasic.class, "");
        pgd.addClass("ridpairsimproved", RIDPairsImproved.class, "");
        pgd.addClass("ridpairsppjoin", RIDPairsPPJoin.class, "");
        pgd.addClass("recordpairsbasic", RecordPairsBasic.class, "");
        pgd.addClass("recordpairsimproved", RecordPairsImproved.class, "");
        pgd.addClass("ridrecordpairsimproved", RIDRecordPairsImproved.class, "");
        pgd.addClass("ridrecordpairsppjoin", RIDRecordPairsPPJoin.class, "");
        pgd.addClass("recordgenerate", RecordGenerate.class, "");
        pgd.addClass("recordbalance", RecordBalance.class, "");
        pgd.driver(argv);
        // Success
        exitCode = 0;
    } catch (Throwable e) {
        e.printStackTrace();
    }
    System.exit(exitCode);
}

From source file:edu.ucsb.cs.knn.KnnDriver.java

License:Apache License

/**
 * Presents the available job options for the user to choose from. Then
 * invoke the class responsible for configuring the job.
 *//*  www .j  ava  2 s .c  o  m*/
public static void main(String argv[]) {

    int exitCode = -1;
    ProgramDriver pgd = new ProgramDriver();
    try {
        pgd.addClass("invindex", SongInvertedIndexMain.class, "Generate song inverted index for Yahoo data.");
        pgd.addClass("forindex", UserForwardIndexMain.class, "Generate user forward index for Yahoo data.");
        pgd.addClass("invertedknn", InvertedMain.class, " knn over songs inverted index.");
        pgd.addClass("hybridknn", HybridMain.class, " not yet done ...knn over songs forward index.");
        // pgd.addClass("estimateknn", InvertedMain.class, " TO-DO.");
        pgd.addClass("readseq", SequenceReader.class, " View sequence file as text to read.");
        pgd.addClass("queryknn", QueryMain.class, " Query the KNN results for recommendation.");
        pgd.driver(argv);
        exitCode = 0;
    } catch (Throwable e) {
        e.printStackTrace();
    }
    System.exit(exitCode);
}

From source file:edu.ucsb.cs.lsh.LshDriver.java

License:Apache License

public static void main(String argv[]) {
    int exitCode = -1;
    ProgramDriver pgd = new ProgramDriver();
    try {/*from  w  w w .j av a2 s .  co m*/
        pgd.addClass("randomlsh", ProjectionLshDriver.class,
                "Partition input vectors according to random projections.");
        pgd.addClass("minhashlsh", MinHashLshDriver.class,
                "Partition input vectors according to minhash values.");
        pgd.addClass("lshstat", LshStat.class, "Collect statistics from binray lshpartitions/");
        pgd.driver(argv);
    } catch (Throwable e) {
        e.printStackTrace();
    }

    System.exit(exitCode);
}

From source file:edu.ucsb.cs.preprocessing.PreprocessDriver.java

License:Apache License

/**
 * Prints these options to chose from:<br>
 * - [clean] documents to produce document ID: bag of cleaned words. <br>
 * - [hash] bag of words into bag of hashed tokens.<br>
 * - Produce [sequence] records [LongWritable,FeatureWeightArrayWritable] <br>
 * - [seq] deals with writing/reading/combining sequence files.
 * //ww w. j av  a 2s  .  c  o m
 * @param argv : command line inputs
 */
public static void main(String argv[]) {
    int exitCode = -1;
    ProgramDriver pgd = new ProgramDriver();
    try {
        pgd.addClass("clean", CleanPagesDriver.class, "A MapReduce job to clean input pages. See options.");
        pgd.addClass("hash", HashPagesDriver.class,
                "A MapReduce job to collect features then hash input data into [docId <features>] with associated weights if desired. ");
        pgd.addClass("seq", SequenceDriver.class,
                "For writing/reading/merging sequence files. See optoins.\n\n");
        pgd.driver(argv);
    } catch (Throwable e) {
        e.printStackTrace();
    }

    System.exit(exitCode);
}

From source file:edu.ucsb.cs.sort.SortDriver.java

License:Apache License

public static void main(String args[]) throws UnsupportedEncodingException {

    ProgramDriver pgd = new ProgramDriver();
    try {/*  w ww.  j  av  a 2  s  .  c  o m*/
        pgd.addClass("lengthsort", LengthSortMain.class, "\tSort documents based on length");
        pgd.addClass("normsort", NormSortMain.class, "\tSort documents based on p-norm");
        pgd.addClass("maxwsort", MaxwSortMain.class, "\tSort documents based on max weight");// del
        pgd.addClass("sigsort", SigSortMain.class, "\tSort documents based on their signatures");
        pgd.driver(args);
    } catch (Throwable e) {
        e.printStackTrace();
    }
}

From source file:edu.umn.cs.spatialHadoop.operations.Main.java

License:Open Source License

public static void main(String[] args) {
    int exitCode = -1;
    ProgramDriver pgd = new ProgramDriver();
    try {/*from   w w w. j  a  va 2 s. c om*/
        pgd.addClass("rangequery", RangeQuery.class,
                "Finds all objects in the query range given by a rectangle");

        pgd.addClass("knn", KNN.class, "Finds the k nearest neighbor in a file to a point");

        pgd.addClass("dj", DistributedJoin.class,
                "Computes the spatial join between two input files using the " + "distributed join algorithm");

        pgd.addClass("sjmr", SJMR.class,
                "Computes the spatial join between two input files using the " + "SJMR algorithm");

        pgd.addClass("index", Indexer.class, "Spatially index a file using a specific indexer");

        pgd.addClass("oldindex", Repartition.class, "Spatially index a file using a specific indexer");

        pgd.addClass("mbr", FileMBR.class, "Finds the minimal bounding rectangle of an input file");

        pgd.addClass("readfile", ReadFile.class, "Retrieve some information about the index of a file");

        pgd.addClass("sample", Sampler.class, "Reads a random sample from the input file");

        pgd.addClass("generate", RandomSpatialGenerator.class,
                "Generates a random file containing spatial data");

        pgd.addClass("union", Union.class, "Computes the union of input shapes");

        pgd.addClass("uunion", UltimateUnion.class,
                "Computes the union of input shapes using the UltimateUnion algorithm");

        pgd.addClass("delaunay", DelaunayTriangulation.class,
                "Computes the Delaunay triangulation for a set of points");

        pgd.addClass("multihdfplot", MultiHDFPlot.class,
                "Plots NASA datasets in the spatiotemporal range provided by user");

        pgd.addClass("hdfplot", HDFPlot.class, "Plots a heat map for a give NASA dataset");

        pgd.addClass("gplot", GeometricPlot.class, "Plots a file to an image");

        pgd.addClass("hplot", HeatMapPlot.class, "Plots a heat map to an image");

        pgd.addClass("lakesplot", LakesPlot.class, "Plots lakes to SVG image");

        pgd.addClass("hdfx", HDFToText.class, "Extracts data from a set of HDF files to text files");

        pgd.addClass("skyline", Skyline.class, "Computes the skyline of an input set of points");

        pgd.addClass("convexhull", ConvexHull.class, "Computes the convex hull of an input set of points");

        pgd.addClass("farthestpair", FarthestPair.class,
                "Computes the farthest pair of point of an input set of points");

        pgd.addClass("closestpair", ClosestPair.class,
                "Computes the closest pair of point of an input set of points");

        pgd.addClass("distcp", DistributedCopy.class, "Copies a directory or file using a MapReduce job");

        pgd.addClass("vizserver", ShahedServer.class, "Starts a server that handles visualization requests");

        pgd.addClass("staggquery", SpatioAggregateQueries.class,
                "Runs a spatio temporal aggregate query on HDF files");

        pgd.addClass("shahedindexer", AggregateQuadTree.class,
                "Creates a multilevel spatio-temporal indexer for NASA data");

        pgd.addClass("hadoopviz", HadoopvizServer.class, "Run Hadoopviz Server");

        pgd.addClass("mplot", MagickPlot.class, "Plot using ImageMagick");

        pgd.driver(args);

        // Success
        exitCode = 0;
    } catch (Throwable e) {
        e.printStackTrace();
    }

    System.exit(exitCode);
}

From source file:hadoop.examples.mapreduce.ExampleDriver.java

License:Open Source License

public static void main(String[] args) {
    int exitCode = -1;
    try {//w  w w  . ja v  a  2  s. c om
        ProgramDriver prog = new ProgramDriver();
        prog.addClass("wordcountV1", WordCountV1.class, " Word count Version 1");
        prog.addClass("wordcountV2", WordCountV2.class, " Word count Version 2");
        prog.driver(args);

        //Success
        exitCode = 0;
    } catch (Throwable e) {
        e.printStackTrace();
    }
    System.exit(exitCode);
}

From source file:hjkoo.Driver.java

License:Apache License

public static void main(String argv[]) {
    int exitCode = -1;
    ProgramDriver pgd = new ProgramDriver();
    try {/*from ww  w. j  a v  a 2 s . c  o m*/
        pgd.addClass("skewedreducer", SkewedReducer.class, "Test for Skewed Reducer");
        pgd.addClass("wordcount", WordCount.class, "WordCount example");
        pgd.addClass("invind", InvInd.class, "Inverted Index");
        pgd.addClass("kmeans", kmeans.class, "sequential_kmeans clustering");
        pgd.addClass("kmeans2", kmeans2.class, "parallel_kmeans clustering");
        /*
              pgd.addClass("aggregatewordcount", AggregateWordCount.class, 
           "An Aggregate based map/reduce program that counts the words in the input files.");
              pgd.addClass("aggregatewordhist", AggregateWordHistogram.class, 
           "An Aggregate based map/reduce program that computes the histogram of the words in the input files.");
              pgd.addClass("grep", Grep.class, 
           "A map/reduce program that counts the matches of a regex in the input.");
              pgd.addClass("randomwriter", RandomWriter.class, 
           "A map/reduce program that writes 10GB of random data per node.");
              pgd.addClass("randomtextwriter", RandomTextWriter.class, 
              "A map/reduce program that writes 10GB of random textual data per node.");
              pgd.addClass("sort", Sort.class, "A map/reduce program that sorts the data written by the random writer.");
              pgd.addClass("pi", PiEstimator.class, "A map/reduce program that estimates Pi using monte-carlo method.");
              pgd.addClass("pentomino", DistributedPentomino.class,
              "A map/reduce tile laying program to find solutions to pentomino problems.");
              pgd.addClass("secondarysort", SecondarySort.class,
           "An example defining a secondary sort to the reduce.");
              pgd.addClass("sudoku", Sudoku.class, "A sudoku solver.");
              pgd.addClass("sleep", SleepJob.class, "A job that sleeps at each map and reduce task.");
              pgd.addClass("join", Join.class, "A job that effects a join over sorted, equally partitioned datasets");
              pgd.addClass("multifilewc", MultiFileWordCount.class, "A job that counts words from several files.");
              pgd.addClass("dbcount", DBCountPageView.class, "An example job that count the pageview counts from a database.");
              pgd.addClass("teragen", TeraGen.class, "Generate data for the terasort");
              pgd.addClass("terasort", TeraSort.class, "Run the terasort");
              pgd.addClass("teravalidate", TeraValidate.class, "Checking results of terasort");
        */
        pgd.driver(argv);

        // Success
        exitCode = 0;
    } catch (Throwable e) {
        e.printStackTrace();
    }

    System.exit(exitCode);
}

From source file:net.java.jatextmining.JaTextminingDriver.java

License:Apache License

/**
 * A main method for this class./*from w w  w.  ja v  a  2  s.c o  m*/
 * @param argv A arguments from command-line.
 */
public static void main(String[] argv) {
    int exitCode = -1;
    ProgramDriver driver = new ProgramDriver();
    try {
        driver.addClass("wordcount", JaWordCounter.class,
                "A map/reduce " + "program that counts the words from Japnese document.");
        driver.addClass("cooccurrence", JaCoOccurrence.class,
                "A map/reduce" + " program that count the co-occurrence word.");
        driver.addClass("tokenize", TokenizerSample.class,
                "A Sample of" + " tokenizing Japanese document with map/reduce");
        driver.driver(argv);
        exitCode = 0;
    } catch (Throwable e) {
        e.printStackTrace();
    }
    System.exit(exitCode);
}

From source file:org.ankus.mapreduce.AnkusDriver.java

License:Apache License

public static void main(String[] args) {
    ProgramDriver programDriver = new ProgramDriver();

    try {/*from w ww.jav  a  2s .  c  om*/
        /**
        * Similarity and distance algorithms
        */
        // Boolean Set
        programDriver.addClass(Constants.ALGORITHM_BOOLEAN_DATA_CORRELATION, BooleanSetDriver.class,
                "BooleanSet driver based map/reduce program that computes the data of the boolean set in the input files.");

        // Numerical Set 
        programDriver.addClass(Constants.ALGORITHM_NUMERIC_DATA_CORRELATION, NumericSetDriver.class,
                "NumericSet driver based map/reduce program that computes the data of the numeric set in the input files.");

        // String Set 
        programDriver.addClass(Constants.ALGORITHM_STRING_DATA_CORRELATION, StringSetDriver.class,
                "StringSet driver based map/reduce program that computes the data of the string set in the input files.");

        /**
         * Collaborative Filtering by CF-base
         */
        programDriver.addClass(Constants.ALGORITHM_COLLABORATIVE_FILTERING_BASED_SIMILARITY,
                CFBasedSimilarityDriver.class,
                "Collaborative filtering driver based map/reduce program that computes the data of the data set in the input files.");

        /**
        * Recommendation system by user-base
        */
        programDriver.addClass(Constants.ALGORITHM_USER_BASED_RECOMMENDATION,
                UserbasedRecommendationDriver.class,
                "Recommendation driver user based map/reduce program that computes the data of the data set in the input files.");

        /**
        * Development Finish Classes (need to generate comments and documents of codes)>
        *       statistics.NumericStatsDriver
        *       statistics.NominalStatsDriver
        *       statistics.CertaintyFactorSumDriver
        *       preprocessing.Normalize
        */
        programDriver.addClass(Constants.ALGORITHM_NUMERIC_STATS, NumericStatsDriver.class,
                "Statistics for Numeric Attributes of Data");
        programDriver.addClass(Constants.ALGORITHM_NOMINAL_STATS, NominalStatsDriver.class,
                "Statistics(frequency/ratio) for Nominal Attributes of Data");
        programDriver.addClass(Constants.ALGORITHM_CERTAINTYFACTOR_SUM, CertaintyFactorSumDriver.class,
                "Certainty Factor based Summation for Numeric Attributes of Data");
        programDriver.addClass(Constants.ALGORITHM_NORMALIZE, NormalizeDriver.class,
                "Normalization for Numeric Attributes of Data");
        programDriver.addClass(Constants.ALGORITHM_KMEANS_CLUSTERING, KMeansDriver.class,
                "K-means clustering Algorithm");

        programDriver.driver(args);

        // Success
        System.exit(0);

    } catch (Throwable e) {
        e.printStackTrace();
        System.exit(-1);
    }
}