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_dtree.RegTraverseDenseBatch.DTREGTAVDaalLauncher.java

License:Apache License

/**
 * Launches all the tasks in order./*w ww.  ja  v  a  2 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();

    //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.set(HarpDAALConstants.TRAIN_PRUNE_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 dtregtavJob = init.createJob("dtregtavJob", DTREGTAVDaalLauncher.class,
            DTREGTAVDaalCollectiveMapper.class);

    // finish job
    boolean jobSuccess = dtregtavJob.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) {
        dtregtavJob.killJob();
        System.out.println("dtregtavJob failed");
    }

    return 0;
}

From source file:edu.iu.daal_em.BatchDense.EMDaalLauncher.java

License:Apache License

/**
 * Launches all the tasks in order./*from  www .  j a  v a 2  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();

    //load app args
    conf.setInt(HarpDAALConstants.FILE_DIM, Integer.parseInt(args[init.getSysArgNum()]));
    conf.setInt(Constants.NUM_COMPONENTS, 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 emJob = init.createJob("emJob", EMDaalLauncher.class, EMDaalCollectiveMapper.class);

    // finish job
    boolean jobSuccess = emJob.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) {
        emJob.killJob();
        System.out.println("emJob failed");
    }

    return 0;
}

From source file:edu.iu.daal_kernel_func.LinCSRBatch.LinCSRDaalLauncher.java

License:Apache License

/**
 * Launches all the tasks in order./*from   w  ww . ja v  a2s .c om*/
 */
@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.setDouble(Constants.K, Double.parseDouble(args[init.getSysArgNum()]));
    conf.setDouble(Constants.B, Double.parseDouble(args[init.getSysArgNum() + 1]));
    conf.set(Constants.RIGHT_FILE_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 kernellinJob = init.createJob("kernellinJob", LinCSRDaalLauncher.class,
            LinCSRDaalCollectiveMapper.class);

    // finish job
    boolean jobSuccess = kernellinJob.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) {
        kernellinJob.killJob();
        System.out.println("kernellinJob failed");
    }

    return 0;
}

From source file:edu.iu.daal_kernel_func.LinDenseBatch.LinDenseDaalLauncher.java

License:Apache License

/**
 * Launches all the tasks in order.//from w w  w . j av a 2s .  c om
 */
@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.setDouble(Constants.K, Double.parseDouble(args[init.getSysArgNum()] + 2));
    conf.setDouble(Constants.B, Double.parseDouble(args[init.getSysArgNum() + 3]));
    conf.set(Constants.RIGHT_FILE_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 kernellinJob = init.createJob("kernellinJob", LinDenseDaalLauncher.class,
            LinDenseDaalCollectiveMapper.class);

    // finish job
    boolean jobSuccess = kernellinJob.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) {
        kernellinJob.killJob();
        System.out.println("kernellinJob failed");
    }

    return 0;
}

From source file:edu.iu.daal_kernel_func.RbfCSRBatch.RbfCSRDaalLauncher.java

License:Apache License

/**
 * Launches all the tasks in order.//from  w w  w  . j av  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();

    //load app args
    conf.setDouble(Constants.SIGMA, Double.parseDouble(args[init.getSysArgNum()]));
    conf.set(Constants.RIGHT_FILE_PATH, 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 kernelRbfJob = init.createJob("kernelRbfJob", RbfCSRDaalLauncher.class,
            RbfCSRDaalCollectiveMapper.class);

    // finish job
    boolean jobSuccess = kernelRbfJob.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) {
        kernelRbfJob.killJob();
        System.out.println("kernelRbfJob failed");
    }

    return 0;
}

From source file:edu.iu.daal_kernel_func.RbfDenseBatch.RbfDenseDaalLauncher.java

License:Apache License

/**
 * Launches all the tasks in order.//from w  w w .java 2 s.c  om
 */
@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.setDouble(Constants.SIGMA, Double.parseDouble(args[init.getSysArgNum() + 2]));
    conf.set(Constants.RIGHT_FILE_PATH, args[init.getSysArgNum() + 3]);

    // 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 kernelRbfJob = init.createJob("kernelRbfJob", RbfDenseDaalLauncher.class,
            RbfDenseDaalCollectiveMapper.class);

    // finish job
    boolean jobSuccess = kernelRbfJob.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) {
        kernelRbfJob.killJob();
        System.out.println("kernelRbfJob failed");
    }

    return 0;
}

From source file:edu.iu.daal_kmeans.allreducecsr.KmeansDaalLauncher.java

License:Apache License

/**
 * Launches all the tasks in order./*from   w w w. j  av 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.NUM_CLASS, Integer.parseInt(args[init.getSysArgNum()]));
    conf.setInt(Constants.NUM_VEC_BLOCK, 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 kmeansJob = init.createJob("kmeansJob", KmeansDaalLauncher.class, KmeansDaalCollectiveMapper.class);

    // finish job
    boolean jobSuccess = kmeansJob.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) {
        kmeansJob.killJob();
        System.out.println("kmeansJob failed");
    }

    return 0;
}

From source file:edu.iu.daal_kmeans.regroupallgather.KMeansDaalLauncher.java

License:Apache License

/**
 * Launches all the tasks in order.//from  ww  w  .  j  av a  2 s .  c  om
 */
@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_CENTROIDS, Integer.parseInt(args[init.getSysArgNum() + 2]));

    // 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 kmeansJob = init.createJob("kmeansJob", KMeansDaalLauncher.class, KMeansDaalCollectiveMapper.class);

    // initialize centroids data
    JobConf thisjobConf = (JobConf) kmeansJob.getConfiguration();
    FileSystem fs = FileSystem.get(conf);
    int nFeatures = Integer.parseInt(args[init.getSysArgNum() + 1]);
    int numCentroids = Integer.parseInt(args[init.getSysArgNum() + 2]);
    Path workPath = init.getWorkPath();
    Path cenDir = new Path(workPath, "centroids");
    fs.mkdirs(cenDir);
    if (fs.exists(cenDir)) {
        fs.delete(cenDir, true);
    }

    Path initCenDir = new Path(cenDir, "init_centroids");
    DataGenerator.generateDenseDataSingle(numCentroids, nFeatures, 1000, 0, " ", initCenDir, fs);
    thisjobConf.set(HarpDAALConstants.CEN_DIR, cenDir.toString());
    thisjobConf.set(HarpDAALConstants.CENTROID_FILE_NAME, "init_centroids");

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

        DataGenerator.generateDenseDataMulti(total_points, nFeatures, total_files, 2, 1, ",", inputPath,
                tmpDirPathName, fs);
    }

    // finish job
    boolean jobSuccess = kmeansJob.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) {
        kmeansJob.killJob();
        System.out.println("kmeansJob failed");
    }

    return 0;
}

From source file:edu.iu.daal_knn.BatchDense.KNNDaalLauncher.java

License:Apache License

/**
 * Launches all the tasks in order./*from   w w w.  ja  v a2s.c om*/
 */
@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.set(HarpDAALConstants.TEST_FILE_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 knnJob = init.createJob("knnJob", KNNDaalLauncher.class, KNNDaalCollectiveMapper.class);

    // finish job
    boolean jobSuccess = knnJob.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) {
        knnJob.killJob();
        System.out.println("knnJob failed");
    }

    return 0;
}

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

License:Apache License

private void runLinReg(Path inputDir, String testDirPath, String testGroundTruthDirPath, int mem, int batchSize,
        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 a  v a 2s  .c  om
            "Start Job#" + " " + new SimpleDateFormat("HH:mm:ss.SSS").format(Calendar.getInstance().getTime()));

    Job linRegJob = configureLinRegJob(inputDir, testDirPath, testGroundTruthDirPath, mem, batchSize,
            numMapTasks, numThreadsPerWorker, modelDir, outputDir, configuration);

    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("LinReg Job failed");
    }
}