Example usage for org.apache.hadoop.mapred JobID getId

List of usage examples for org.apache.hadoop.mapred JobID getId

Introduction

In this page you can find the example usage for org.apache.hadoop.mapred JobID getId.

Prototype

public int getId() 

Source Link

Document

returns the int which represents the identifier

Usage

From source file:com.liveramp.cascading_ext.flow.LoggingFlow.java

License:Apache License

private void logJobIDs() {
    boolean exceptions = false;
    try {// w w  w .  j  a  v  a  2 s .c o m
        List<FlowStepStats> stepStats = getFlowStats().getFlowStepStats();
        List<String> jobIDs = new ArrayList<String>();
        for (FlowStepStats stat : stepStats) {

            try {
                JobID jobid = ((HadoopStepStats) stat).getRunningJob().getID();
                String jtID = jobid.getJtIdentifier();
                String jobID = Integer.toString(jobid.getId());
                jobIDs.add(jtID + "_" + jobID);
            } catch (Exception e) {
                exceptions = true;
            }
        }

        if (exceptions) {
            LOG.info("unable to retrieve jobid from all completed steps!");
            LOG.info("successfully retrieved job ids: " + StringUtils.join(jobIDs, ", "));
        } else {
            LOG.info("step job ids: " + StringUtils.join(jobIDs, ", "));
        }
    } catch (Exception e) {
        LOG.info("unable to retrieve any jobids from steps");
    }
}

From source file:com.mellanox.hadoop.mapred.UdaPluginSH.java

License:Apache License

static IndexRecordBridge getPathIndex(String jobIDStr, String mapId, int reduce) {
    String user = userRsrc.get(jobIDStr);

    ///////////////////////
    JobID jobID = JobID.forName(jobIDStr);
    ApplicationId appID = ApplicationId.newInstance(Long.parseLong(jobID.getJtIdentifier()), jobID.getId());
    final String base = ContainerLocalizer.USERCACHE + "/" + user + "/" + ContainerLocalizer.APPCACHE + "/"
            + ConverterUtils.toString(appID) + "/output" + "/" + mapId;
    if (LOG.isDebugEnabled()) {
        LOG.debug("DEBUG0 " + base);
    }/*from w w w  .  ja va 2  s  .c  o  m*/
    // Index file
    IndexRecordBridge data = null;
    try {
        Path indexFileName = lDirAlloc.getLocalPathToRead(base + "/file.out.index", mjobConf);
        // Map-output file
        Path mapOutputFileName = lDirAlloc.getLocalPathToRead(base + "/file.out", mjobConf);
        if (LOG.isDebugEnabled()) {
            LOG.debug("DEBUG1 " + base + " : " + mapOutputFileName + " : " + indexFileName);
        }

        ///////////////////////
        // TODO: is this correct ?? - why user and not runAsUserName like in hadoop-1 ?? 
        // on 2nd thought, this sounds correct, because probably we registered the runAsUser and not the "user"
        data = indexCache.getIndexInformationBridge(mapId, reduce, indexFileName, user);
        data.pathMOF = mapOutputFileName.toString();
    } catch (IOException e) {
        LOG.error("got an exception while retrieving the Index Info");
    }

    return data;

}

From source file:org.apache.tez.mapreduce.hadoop.IDConverter.java

License:Apache License

public static TezDAGID fromMRJobId(org.apache.hadoop.mapreduce.JobID jobId) {
    return TezDAGID.getInstance(ApplicationId.newInstance(Long.valueOf(jobId.getJtIdentifier()), jobId.getId()),
            1);//from  w w w  .j  ava 2s. c  o m
}

From source file:org.lilyproject.hadooptestfw.fork.MiniMRCluster.java

License:Apache License

/**
 * Get the events list at the tasktracker
 *//* w  ww  .  j a v  a 2s . co  m*/
public MapTaskCompletionEventsUpdate getMapTaskCompletionEventsUpdates(int index, JobID jobId, int max)
        throws IOException {
    String jtId = jobTracker.getJobTracker().getTrackerIdentifier();
    TaskAttemptID dummy = new TaskAttemptID(jtId, jobId.getId(), false, 0, 0);
    return taskTrackerList.get(index).getTaskTracker().getMapCompletionEvents(jobId, 0, max, dummy, null);
}