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

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

Introduction

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

Prototype

public String getJobName() 

Source Link

Document

The user-specified job name.

Usage

From source file:org.apache.parquet.hadoop.DeprecatedInputFormatTest.java

License:Apache License

private void waitForJob(Job job) throws InterruptedException, IOException {
    while (!job.isComplete()) {
        System.out.println("waiting for job " + job.getJobName());
        sleep(100);//from  w w w  . j  a v  a2s .  c  om
    }
    System.out.println(
            "status for job " + job.getJobName() + ": " + (job.isSuccessful() ? "SUCCESS" : "FAILURE"));
    if (!job.isSuccessful()) {
        throw new RuntimeException("job failed " + job.getJobName());
    }
}

From source file:org.apache.parquet.hadoop.example.TestInputOutputFormat.java

License:Apache License

private void waitForJob(Job job) throws InterruptedException, IOException {
    while (!job.isComplete()) {
        LOG.debug("waiting for job " + job.getJobName());
        sleep(100);//from w  w  w.  j a va  2 s . c  o  m
    }
    LOG.info("status for job " + job.getJobName() + ": " + (job.isSuccessful() ? "SUCCESS" : "FAILURE"));
    if (!job.isSuccessful()) {
        throw new RuntimeException("job failed " + job.getJobName());
    }
}

From source file:org.apache.parquet.hadoop.TestInputFormatColumnProjection.java

License:Apache License

private void waitForJob(Job job) throws Exception {
    job.submit();/*from ww w.  j  a v  a  2s .  c o m*/
    while (!job.isComplete()) {
        sleep(100);
    }
    if (!job.isSuccessful()) {
        throw new RuntimeException("job failed " + job.getJobName());
    }
}

From source file:org.apache.parquet.hadoop.thrift.TestInputOutputFormat.java

License:Apache License

public static void waitForJob(Job job) throws Exception {
    job.submit();/*  w ww.j  a  va  2s  . co  m*/
    while (!job.isComplete()) {
        LOG.debug("waiting for job " + job.getJobName());
        sleep(100);
    }
    LOG.info("status for job " + job.getJobName() + ": " + (job.isSuccessful() ? "SUCCESS" : "FAILURE"));
    if (!job.isSuccessful()) {
        throw new RuntimeException("job failed " + job.getJobName());
    }
}

From source file:org.apache.parquet.proto.utils.WriteUsingMR.java

License:Apache License

static void waitForJob(Job job) throws Exception {
    job.submit();/*w  w  w  .j  a  v a  2 s .com*/
    while (!job.isComplete()) {
        LOG.debug("waiting for job " + job.getJobName());
        sleep(50);
    }
    LOG.debug("status for job " + job.getJobName() + ": " + (job.isSuccessful() ? "SUCCESS" : "FAILURE"));
    if (!job.isSuccessful()) {
        throw new RuntimeException("job failed " + job.getJobName());
    }
}

From source file:org.apache.rya.accumulo.pig.AccumuloStorage.java

License:Apache License

@Override
public void setLocation(final String location, final Job job) throws IOException {
    if (logger.isDebugEnabled()) {
        logger.debug("Set Location[" + location + "] for job[" + job.getJobName() + "]");
    }/*www.  j  ava2  s  .c  om*/
    conf = job.getConfiguration();
    setLocationFromUri(location, job);

    if (!ConfiguratorBase.isConnectorInfoSet(AccumuloInputFormat.class, conf)) {
        try {
            AccumuloInputFormat.setConnectorInfo(job, user,
                    new PasswordToken(password.getBytes(StandardCharsets.UTF_8)));
        } catch (final AccumuloSecurityException e) {
            throw new RuntimeException(e);
        }
        AccumuloInputFormat.setInputTableName(job, table);
        AccumuloInputFormat.setScanAuthorizations(job, authorizations);
        if (!mock) {
            AccumuloInputFormat.setZooKeeperInstance(job, inst, zookeepers);
        } else {
            AccumuloInputFormat.setMockInstance(job, inst);
        }
    }
    if (columnFamilyColumnQualifierPairs.size() > 0) {
        AccumuloInputFormat.fetchColumns(job, columnFamilyColumnQualifierPairs);
    }
    logger.info("Set ranges[" + ranges + "] for job[" + job.getJobName() + "] on table[" + table + "] "
            + "for columns[" + columnFamilyColumnQualifierPairs + "] with authorizations[" + authorizations
            + "]");

    if (ranges.size() == 0) {
        throw new IOException("Accumulo Range must be specified");
    }
    AccumuloInputFormat.setRanges(job, ranges);
}

From source file:org.apache.solr.hadoop.ForkedMapReduceIndexerTool.java

License:Apache License

private static String getJobInfo(Job job) {
    return "jobName: " + job.getJobName() + ", jobId: " + job.getJobID();
}

From source file:org.apdplat.borm.PersonAnalytics.java

License:Open Source License

public Job createJob(DataStore<String, Person> inStore, int numReducer) throws IOException {
    Job job = new Job(getConf());
    job.setJobName("Person Analytics");
    log.info("Creating Hadoop Job: " + job.getJobName());
    job.setNumReduceTasks(numReducer);//from   ww w  . j  a va  2 s . com
    job.setJarByClass(getClass());
    GoraMapper.initMapperJob(job, inStore, Text.class, LongWritable.class, PersonAnalyticsMapper.class, true);
    job.setReducerClass(PersonAnalyticsReducer.class);
    job.setOutputKeyClass(Text.class);
    job.setOutputValueClass(LongWritable.class);
    TextOutputFormat.setOutputPath(job, new Path("person-analytics-output"));
    return job;
}

From source file:org.huahinframework.core.SequencalJobChain.java

License:Apache License

/**
 * Run all of the job has been added.//from   w  w  w.j  a  va  2  s .  co m
 * @return all jobs status
 */
public SequencalJobExecuteResults runAll() {
    SequencalJobExecuteResults results = new SequencalJobExecuteResults();
    for (Job job : jobs) {
        job.setJarByClass(SequencalJobChain.class);
        try {
            boolean isSuccessful = job.waitForCompletion(true);
            results.add(new SequencalJobExecuteResult(isSuccessful, job.getJobName()));
            if (!isSuccessful) {
                break;
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
    return results;
}

From source file:org.huahinframework.manager.rest.service.JobService.java

License:Apache License

/**
 * @return {@link JSONObject}//from  ww w.  j a va 2s .  co m
 */
@Path("/kill/name/{" + JOBNAME + "}")
@DELETE
@Produces(MediaType.APPLICATION_JSON)
public JSONObject killJobName(@PathParam(JOBNAME) String jobName) {
    Map<String, String> status = new HashMap<String, String>();
    try {
        Cluster cluster = new Cluster(getJobConf());
        for (JobStatus jobStatus : cluster.getAllJobStatuses()) {
            Job job = cluster.getJob(jobStatus.getJobID());
            if (job == null) {
                break;
            }

            if (job.getJobName().equals(jobName)) {
                job.killJob();
                status.put(Response.STATUS, "Killed job " + jobName);
                break;
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
        log.error(e);
        status.put(Response.STATUS, e.getMessage());
    }

    if (status.isEmpty()) {
        status.put(Response.STATUS, "Could not find job " + jobName);
    }

    return new JSONObject(status);
}