Example usage for org.apache.hadoop.mapreduce Job killJob

List of usage examples for org.apache.hadoop.mapreduce Job killJob

Introduction

In this page you can find the example usage for org.apache.hadoop.mapreduce Job killJob.

Prototype

public void killJob() throws IOException 

Source Link

Document

Kill the running job.

Usage

From source file:edu.iu.daal_linreg.normaleq.LinRegDaalLauncher.java

License:Apache License

/**
 * Launches all the tasks in order./*  w  w w.ja  v a 2s.c o  m*/
 */
@Override
public int run(String[] args) throws Exception {

    /* Put shared libraries into the distributed cache */
    Configuration conf = this.getConf();

    Initialize init = new Initialize(conf, args);

    /* Put shared libraries into the distributed cache */
    init.loadDistributedLibs();

    // load args
    init.loadSysArgs();

    //load app args
    conf.setInt(HarpDAALConstants.FILE_DIM, Integer.parseInt(args[init.getSysArgNum()]));
    conf.setInt(HarpDAALConstants.FEATURE_DIM, Integer.parseInt(args[init.getSysArgNum() + 1]));
    conf.setInt(HarpDAALConstants.NUM_DEPVAR, Integer.parseInt(args[init.getSysArgNum() + 2]));
    conf.set(HarpDAALConstants.TEST_FILE_PATH, args[init.getSysArgNum() + 3]);
    conf.set(HarpDAALConstants.TEST_TRUTH_PATH, args[init.getSysArgNum() + 4]);

    // launch job
    System.out.println("Starting Job");
    long perJobSubmitTime = System.currentTimeMillis();
    System.out.println(
            "Start Job#" + " " + new SimpleDateFormat("HH:mm:ss.SSS").format(Calendar.getInstance().getTime()));

    Job linRegJob = init.createJob("linRegJob", LinRegDaalLauncher.class, LinRegDaalCollectiveMapper.class);

    // finish job
    boolean jobSuccess = linRegJob.waitForCompletion(true);
    System.out.println(
            "End Job#" + " " + new SimpleDateFormat("HH:mm:ss.SSS").format(Calendar.getInstance().getTime()));
    System.out.println(
            "| Job#" + " Finished in " + (System.currentTimeMillis() - perJobSubmitTime) + " miliseconds |");
    if (!jobSuccess) {
        linRegJob.killJob();
        System.out.println("linRegJob failed");
    }

    return 0;
}

From source file:edu.iu.daal_logitboost.LOGITBOOSTDaalLauncher.java

License:Apache License

/**
 * Launches all the tasks in order.//www .j  ava  2  s .  com
 */
@Override
public int run(String[] args) throws Exception {

    /* Put shared libraries into the distributed cache */
    Configuration conf = this.getConf();

    Initialize init = new Initialize(conf, args);

    /* Put shared libraries into the distributed cache */
    init.loadDistributedLibs();

    // load args
    init.loadSysArgs();

    //load app args
    conf.setInt(HarpDAALConstants.FEATURE_DIM, Integer.parseInt(args[init.getSysArgNum()]));
    conf.setInt(HarpDAALConstants.FILE_DIM, Integer.parseInt(args[init.getSysArgNum() + 1]));
    conf.setInt(HarpDAALConstants.NUM_CLASS, Integer.parseInt(args[init.getSysArgNum() + 2]));
    conf.setInt(HarpDAALConstants.MAX_ITERATIONS, Integer.parseInt(args[init.getSysArgNum() + 3]));
    conf.setDouble(HarpDAALConstants.ACC_THRESHOLD, Double.parseDouble(args[init.getSysArgNum() + 4]));
    conf.set(HarpDAALConstants.TEST_FILE_PATH, args[init.getSysArgNum() + 5]);

    // launch job
    System.out.println("Starting Job");
    long perJobSubmitTime = System.currentTimeMillis();
    System.out.println(
            "Start Job#" + " " + new SimpleDateFormat("HH:mm:ss.SSS").format(Calendar.getInstance().getTime()));

    Job logitboostJob = init.createJob("logitboostJob", LOGITBOOSTDaalLauncher.class,
            LOGITBOOSTDaalCollectiveMapper.class);

    // finish job
    boolean jobSuccess = logitboostJob.waitForCompletion(true);
    System.out.println(
            "End Job#" + " " + new SimpleDateFormat("HH:mm:ss.SSS").format(Calendar.getInstance().getTime()));
    System.out.println(
            "| Job#" + " Finished in " + (System.currentTimeMillis() - perJobSubmitTime) + " miliseconds |");
    if (!jobSuccess) {
        logitboostJob.killJob();
        System.out.println("logitboostJob failed");
    }

    return 0;
}

From source file:edu.iu.daal_mom.csrdistri.MOMDaalLauncher.java

License:Apache License

/**
 * Launches all the tasks in order./*from   ww w  .ja v a  2 s . co m*/
 */
@Override
public int run(String[] args) throws Exception {

    /* Put shared libraries into the distributed cache */
    Configuration conf = this.getConf();
    Initialize init = new Initialize(conf, args);

    /* Put shared libraries into the distributed cache */
    init.loadDistributedLibs();

    // load args
    init.loadSysArgs();

    // launch job
    System.out.println("Starting Job");
    long perJobSubmitTime = System.currentTimeMillis();
    System.out.println(
            "Start Job#" + " " + new SimpleDateFormat("HH:mm:ss.SSS").format(Calendar.getInstance().getTime()));

    Job momJob = init.createJob("momJob", MOMDaalLauncher.class, MOMDaalCollectiveMapper.class);

    // finish job
    boolean jobSuccess = momJob.waitForCompletion(true);
    System.out.println(
            "End Job#" + " " + new SimpleDateFormat("HH:mm:ss.SSS").format(Calendar.getInstance().getTime()));
    System.out.println(
            "| Job#" + " Finished in " + (System.currentTimeMillis() - perJobSubmitTime) + " miliseconds |");
    if (!jobSuccess) {
        momJob.killJob();
        System.out.println("momJob failed");
    }

    return 0;
}

From source file:edu.iu.daal_mom.densedistri.MOMDaalLauncher.java

License:Apache License

/**
 * Launches all the tasks in order.// w  w  w  .jav  a2  s.c o  m
 */
@Override
public int run(String[] args) throws Exception {

    /* Put shared libraries into the distributed cache */
    Configuration conf = this.getConf();

    Initialize init = new Initialize(conf, args);

    /* Put shared libraries into the distributed cache */
    init.loadDistributedLibs();

    // load args
    init.loadSysArgs();

    conf.setInt(HarpDAALConstants.FILE_DIM, Integer.parseInt(args[init.getSysArgNum()]));
    conf.setInt(HarpDAALConstants.FEATURE_DIM, Integer.parseInt(args[init.getSysArgNum() + 1]));

    // launch job
    System.out.println("Starting Job");
    long perJobSubmitTime = System.currentTimeMillis();
    System.out.println(
            "Start Job#" + " " + new SimpleDateFormat("HH:mm:ss.SSS").format(Calendar.getInstance().getTime()));

    Job momJob = init.createJob("momJob", MOMDaalLauncher.class, MOMDaalCollectiveMapper.class);

    // finish job
    boolean jobSuccess = momJob.waitForCompletion(true);
    System.out.println(
            "End Job#" + " " + new SimpleDateFormat("HH:mm:ss.SSS").format(Calendar.getInstance().getTime()));
    System.out.println(
            "| Job#" + " Finished in " + (System.currentTimeMillis() - perJobSubmitTime) + " miliseconds |");
    if (!jobSuccess) {
        momJob.killJob();
        System.out.println("momJob failed");
    }

    return 0;
}

From source file:edu.iu.daal_mom.MOMDaalLauncher.java

License:Apache License

private void runMOM(Path inputDir, int mem, int numMapTasks, int numThreadsPerWorker, Path modelDir,
        Path outputDir, Configuration configuration)
        throws IOException, URISyntaxException, InterruptedException, ClassNotFoundException {

    System.out.println("Starting Job");

    long perJobSubmitTime = System.currentTimeMillis();
    System.out.println(/*w  w  w.  j  a  v  a  2s  . c o m*/
            "Start Job#" + " " + new SimpleDateFormat("HH:mm:ss.SSS").format(Calendar.getInstance().getTime()));

    Job momJob = configureMOMJob(inputDir, mem, numMapTasks, numThreadsPerWorker, modelDir, outputDir,
            configuration);

    boolean jobSuccess = momJob.waitForCompletion(true);

    System.out.println(
            "End Job#" + " " + new SimpleDateFormat("HH:mm:ss.SSS").format(Calendar.getInstance().getTime()));

    System.out.println(
            "| Job#" + " Finished in " + (System.currentTimeMillis() - perJobSubmitTime) + " miliseconds |");
    // ----------------------------------------
    if (!jobSuccess) {
        momJob.killJob();
        System.out.println("MOM Job failed");
    }
}

From source file:edu.iu.daal_naive.csrdistri.NaiveDaalLauncher.java

License:Apache License

/**
 * Launches all the tasks in order.//from  www  .  jav a  2s.  c  o m
 */
@Override
public int run(String[] args) throws Exception {

    /* Put shared libraries into the distributed cache */
    Configuration conf = this.getConf();

    Initialize init = new Initialize(conf, args);

    /* Put shared libraries into the distributed cache */
    init.loadDistributedLibs();

    // load args
    init.loadSysArgs();

    conf.setInt(HarpDAALConstants.NUM_CLASS, Integer.parseInt(args[init.getSysArgNum()]));
    conf.set(HarpDAALConstants.TEST_FILE_PATH, args[init.getSysArgNum() + 1]);
    conf.set(HarpDAALConstants.TEST_TRUTH_PATH, args[init.getSysArgNum() + 2]);

    // launch job
    System.out.println("Starting Job");
    long perJobSubmitTime = System.currentTimeMillis();
    System.out.println(
            "Start Job#" + " " + new SimpleDateFormat("HH:mm:ss.SSS").format(Calendar.getInstance().getTime()));

    Job nbJob = init.createJob("nbJob", NaiveDaalLauncher.class, NaiveDaalCollectiveMapper.class);

    // finish job
    boolean jobSuccess = nbJob.waitForCompletion(true);
    System.out.println(
            "End Job#" + " " + new SimpleDateFormat("HH:mm:ss.SSS").format(Calendar.getInstance().getTime()));
    System.out.println(
            "| Job#" + " Finished in " + (System.currentTimeMillis() - perJobSubmitTime) + " miliseconds |");
    if (!jobSuccess) {
        nbJob.killJob();
        System.out.println("nbJob failed");
    }

    return 0;
}

From source file:edu.iu.daal_naive.densedistri.NaiveDaalLauncher.java

License:Apache License

/**
 * Launches all the tasks in order./*from w  w w  .  j  a  v a 2 s .co  m*/
 */
@Override
public int run(String[] args) throws Exception {

    /* Put shared libraries into the distributed cache */
    Configuration conf = this.getConf();
    Initialize init = new Initialize(conf, args);

    /* Put shared libraries into the distributed cache */
    init.loadDistributedLibs();
    // load args
    init.loadSysArgs();

    //load app args
    conf.setInt(HarpDAALConstants.FILE_DIM, Integer.parseInt(args[init.getSysArgNum()]));
    conf.setInt(HarpDAALConstants.FEATURE_DIM, Integer.parseInt(args[init.getSysArgNum() + 1]));
    conf.setInt(HarpDAALConstants.NUM_CLASS, Integer.parseInt(args[init.getSysArgNum() + 2]));
    conf.set(HarpDAALConstants.TEST_FILE_PATH, args[init.getSysArgNum() + 3]);
    conf.set(HarpDAALConstants.TEST_TRUTH_PATH, args[init.getSysArgNum() + 4]);

    // config job
    System.out.println("Starting Job");
    long perJobSubmitTime = System.currentTimeMillis();
    System.out.println(
            "Start Job#" + " " + new SimpleDateFormat("HH:mm:ss.SSS").format(Calendar.getInstance().getTime()));
    Job naiveJob = init.createJob("naiveJob", NaiveDaalLauncher.class, NaiveDaalCollectiveMapper.class);

    // initialize centroids data
    JobConf thisjobConf = (JobConf) naiveJob.getConfiguration();
    FileSystem fs = FileSystem.get(conf);
    int nFeatures = Integer.parseInt(args[init.getSysArgNum() + 1]);

    //generate Data if required
    boolean generateData = Boolean.parseBoolean(args[init.getSysArgNum() + 5]);
    if (generateData) {
        Path inputPath = init.getInputPath();
        int nClass = Integer.parseInt(args[init.getSysArgNum() + 2]);
        int total_points = Integer.parseInt(args[init.getSysArgNum() + 6]);
        int total_files = Integer.parseInt(args[init.getSysArgNum() + 7]);

        Path testPath = new Path(args[init.getSysArgNum() + 3]);
        int total_test_points = Integer.parseInt(args[init.getSysArgNum() + 8]);
        Path testGroundTruthPath = new Path(args[init.getSysArgNum() + 4]);
        String tmpDirPathName = args[init.getSysArgNum() + 9];

        // replace it with naive specific data generator
        // generate training data
        DataGenerator.generateDenseDataAndIntLabelMulti(total_points, nFeatures, total_files, 2, 1, nClass, ",",
                inputPath, tmpDirPathName, fs);
        // generate test data a single file
        DataGenerator.generateDenseDataAndIntLabelMulti(total_test_points, nFeatures, 1, 2, 1, nClass, ",",
                testPath, tmpDirPathName, fs);
        // generate test groundtruth data a single file nFeature==1
        DataGenerator.generateDenseLabelMulti(total_test_points, 1, 1, nClass, ",", testGroundTruthPath,
                tmpDirPathName, fs);
    }

    // finish job
    boolean jobSuccess = naiveJob.waitForCompletion(true);
    System.out.println(
            "End Job#" + " " + new SimpleDateFormat("HH:mm:ss.SSS").format(Calendar.getInstance().getTime()));
    System.out.println(
            "| Job#" + " Finished in " + (System.currentTimeMillis() - perJobSubmitTime) + " miliseconds |");
    if (!jobSuccess) {
        naiveJob.killJob();
        System.out.println("naiveJob failed");
    }

    return 0;
}

From source file:edu.iu.daal_naive.NaiveDaalLauncher.java

License:Apache License

private void runNaive(Path inputDir, String testDirPath, String testGroundTruthDirPath, int mem, int vecsize,
        int num_class, int num_test, int numMapTasks, int numThreadsPerWorker, Path modelDir, Path outputDir,
        Configuration configuration)
        throws IOException, URISyntaxException, InterruptedException, ClassNotFoundException {

    System.out.println("Starting Job");

    long perJobSubmitTime = System.currentTimeMillis();
    System.out.println(/*from  www. j  av a2s .  co m*/
            "Start Job#" + " " + new SimpleDateFormat("HH:mm:ss.SSS").format(Calendar.getInstance().getTime()));

    Job naiveJob = configureNaiveJob(inputDir, testDirPath, testGroundTruthDirPath, mem, vecsize, num_class,
            num_test, numMapTasks, numThreadsPerWorker, modelDir, outputDir, configuration);

    boolean jobSuccess = naiveJob.waitForCompletion(true);

    System.out.println(
            "End Job#" + " " + new SimpleDateFormat("HH:mm:ss.SSS").format(Calendar.getInstance().getTime()));

    System.out.println(
            "| Job#" + " Finished in " + (System.currentTimeMillis() - perJobSubmitTime) + " miliseconds |");
    // ----------------------------------------
    if (!jobSuccess) {
        naiveJob.killJob();
        System.out.println("Naive Job failed");
    }
}

From source file:edu.iu.daal_nn.NNDaalLauncher.java

License:Apache License

/**
 * Launches all the tasks in order.//from  w ww.  j  a  va  2 s .co  m
 */
@Override
public int run(String[] args) throws Exception {

    /* Put shared libraries into the distributed cache */
    Configuration conf = this.getConf();

    Initialize init = new Initialize(conf, args);

    /* Put shared libraries into the distributed cache */
    init.loadDistributedLibs();

    // load args
    init.loadSysArgs();

    conf.setInt(HarpDAALConstants.FILE_DIM, Integer.parseInt(args[init.getSysArgNum()]));
    conf.setInt(HarpDAALConstants.FEATURE_DIM, Integer.parseInt(args[init.getSysArgNum() + 1]));
    conf.setInt(HarpDAALConstants.BATCH_SIZE, Integer.parseInt(args[init.getSysArgNum() + 2]));
    conf.set(HarpDAALConstants.TEST_FILE_PATH, args[init.getSysArgNum() + 3]);
    conf.set(HarpDAALConstants.TEST_TRUTH_PATH, args[init.getSysArgNum() + 4]);

    // launch job
    System.out.println("Starting Job");
    long perJobSubmitTime = System.currentTimeMillis();
    System.out.println(
            "Start Job#" + " " + new SimpleDateFormat("HH:mm:ss.SSS").format(Calendar.getInstance().getTime()));

    Job nnJob = init.createJob("nnJob", NNDaalLauncher.class, NNDaalCollectiveMapper.class);

    // finish job
    boolean jobSuccess = nnJob.waitForCompletion(true);
    System.out.println(
            "End Job#" + " " + new SimpleDateFormat("HH:mm:ss.SSS").format(Calendar.getInstance().getTime()));
    System.out.println(
            "| Job#" + " Finished in " + (System.currentTimeMillis() - perJobSubmitTime) + " miliseconds |");
    if (!jobSuccess) {
        nnJob.killJob();
        System.out.println("nnJob failed");
    }

    return 0;
}

From source file:edu.iu.daal_normalization.MinMaxDenseBatch.MinMaxDaalLauncher.java

License:Apache License

/**
 * Launches all the tasks in order.//from w w w.ja v  a  2s .  com
 */
@Override
public int run(String[] args) throws Exception {

    /* Put shared libraries into the distributed cache */
    Configuration conf = this.getConf();

    Initialize init = new Initialize(conf, args);

    /* Put shared libraries into the distributed cache */
    init.loadDistributedLibs();

    // load args
    init.loadSysArgs();

    conf.setInt(HarpDAALConstants.FILE_DIM, Integer.parseInt(args[init.getSysArgNum()]));
    conf.setDouble(Constants.UPPER_BOUND, Double.parseDouble(args[init.getSysArgNum() + 1]));
    conf.setDouble(Constants.LOWER_BOUND, Double.parseDouble(args[init.getSysArgNum() + 2]));

    // launch job
    System.out.println("Starting Job");
    long perJobSubmitTime = System.currentTimeMillis();
    System.out.println(
            "Start Job#" + " " + new SimpleDateFormat("HH:mm:ss.SSS").format(Calendar.getInstance().getTime()));

    Job minmaxJob = init.createJob("minmaxJob", MinMaxDaalLauncher.class, MinMaxDaalCollectiveMapper.class);

    // finish job
    boolean jobSuccess = minmaxJob.waitForCompletion(true);
    System.out.println(
            "End Job#" + " " + new SimpleDateFormat("HH:mm:ss.SSS").format(Calendar.getInstance().getTime()));
    System.out.println(
            "| Job#" + " Finished in " + (System.currentTimeMillis() - perJobSubmitTime) + " miliseconds |");
    if (!jobSuccess) {
        minmaxJob.killJob();
        System.out.println("minmaxJob failed");
    }

    return 0;
}