Java Code Examples for org.apache.hadoop.mapreduce.JobID#toString()

The following examples show how to use org.apache.hadoop.mapreduce.JobID#toString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JobHistoryUtils.java    From hadoop with Apache License 2.0 6 votes vote down vote up
/**
 * Extracts job id from the current hadoop version's job history file name.
 * @param fileName job history file name from which job id is to be extracted
 * @return job id if the history file name format is same as that of the
 * current hadoop version. Returns null otherwise.
 */
private static String extractJobIDFromCurrentHistoryFile(String fileName) {
  JobID id = null;
  if (org.apache.hadoop.mapreduce.v2.jobhistory.JobHistoryUtils
          .isValidJobHistoryFileName(fileName)) {
    try {
      id = org.apache.hadoop.mapreduce.v2.jobhistory.JobHistoryUtils
               .getJobIDFromHistoryFilePath(fileName);
    } catch (IOException e) {
      // Ignore this exception and go ahead with getting of jobID assuming
      // older hadoop verison's history file
    }
  }
  if (id != null) {
    return id.toString();
  }
  return null;
}
 
Example 2
Source File: JobHistoryUtils.java    From big-c with Apache License 2.0 6 votes vote down vote up
/**
 * Extracts job id from the current hadoop version's job history file name.
 * @param fileName job history file name from which job id is to be extracted
 * @return job id if the history file name format is same as that of the
 * current hadoop version. Returns null otherwise.
 */
private static String extractJobIDFromCurrentHistoryFile(String fileName) {
  JobID id = null;
  if (org.apache.hadoop.mapreduce.v2.jobhistory.JobHistoryUtils
          .isValidJobHistoryFileName(fileName)) {
    try {
      id = org.apache.hadoop.mapreduce.v2.jobhistory.JobHistoryUtils
               .getJobIDFromHistoryFilePath(fileName);
    } catch (IOException e) {
      // Ignore this exception and go ahead with getting of jobID assuming
      // older hadoop verison's history file
    }
  }
  if (id != null) {
    return id.toString();
  }
  return null;
}
 
Example 3
Source File: ShuffleHandler.java    From tez with Apache License 2.0 5 votes vote down vote up
private void removeJobShuffleInfo(JobID jobId) throws IOException {
  String jobIdStr = jobId.toString();
  secretManager.removeTokenForJob(jobIdStr);
  userRsrc.remove(jobIdStr);
  if (stateDb != null) {
    try {
      stateDb.delete(bytes(jobIdStr));
    } catch (DBException e) {
      throw new IOException("Unable to remove " + jobId
          + " from state store", e);
    }
  }
}
 
Example 4
Source File: JobInitedEvent.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * Create an event to record job initialization
 * @param id
 * @param launchTime
 * @param totalMaps
 * @param totalReduces
 * @param jobStatus
 * @param uberized True if the job's map and reduce stages were combined
 */
public JobInitedEvent(JobID id, long launchTime, int totalMaps,
                      int totalReduces, String jobStatus, boolean uberized) {
  datum.jobid = new Utf8(id.toString());
  datum.launchTime = launchTime;
  datum.totalMaps = totalMaps;
  datum.totalReduces = totalReduces;
  datum.jobStatus = new Utf8(jobStatus);
  datum.uberized = uberized;
}
 
Example 5
Source File: JobSubmittedEvent.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
   * Create an event to record job submission
   * @param id The job Id of the job
   * @param jobName Name of the job
   * @param userName Name of the user who submitted the job
   * @param submitTime Time of submission
   * @param jobConfPath Path of the Job Configuration file
   * @param jobACLs The configured acls for the job.
   * @param jobQueueName The job-queue to which this job was submitted to
   * @param workflowId The Id of the workflow
   * @param workflowName The name of the workflow
   * @param workflowNodeName The node name of the workflow
   * @param workflowAdjacencies The adjacencies of the workflow
   * @param workflowTags Comma-separated tags for the workflow
   */
  public JobSubmittedEvent(JobID id, String jobName, String userName,
      long submitTime, String jobConfPath,
      Map<JobACL, AccessControlList> jobACLs, String jobQueueName,
      String workflowId, String workflowName, String workflowNodeName,
      String workflowAdjacencies, String workflowTags) {
  datum.jobid = new Utf8(id.toString());
  datum.jobName = new Utf8(jobName);
  datum.userName = new Utf8(userName);
  datum.submitTime = submitTime;
  datum.jobConfPath = new Utf8(jobConfPath);
  Map<CharSequence, CharSequence> jobAcls = new HashMap<CharSequence, CharSequence>();
  for (Entry<JobACL, AccessControlList> entry : jobACLs.entrySet()) {
    jobAcls.put(new Utf8(entry.getKey().getAclName()), new Utf8(
        entry.getValue().getAclString()));
  }
  datum.acls = jobAcls;
  if (jobQueueName != null) {
    datum.jobQueueName = new Utf8(jobQueueName);
  }
  if (workflowId != null) {
    datum.workflowId = new Utf8(workflowId);
  }
  if (workflowName != null) {
    datum.workflowName = new Utf8(workflowName);
  }
  if (workflowNodeName != null) {
    datum.workflowNodeName = new Utf8(workflowNodeName);
  }
  if (workflowAdjacencies != null) {
    datum.workflowAdjacencies = new Utf8(workflowAdjacencies);
  }
  if (workflowTags != null) {
    datum.workflowTags = new Utf8(workflowTags);
  }
}
 
Example 6
Source File: JobInitedEvent.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * Create an event to record job initialization
 * @param id
 * @param launchTime
 * @param totalMaps
 * @param totalReduces
 * @param jobStatus
 * @param uberized True if the job's map and reduce stages were combined
 */
public JobInitedEvent(JobID id, long launchTime, int totalMaps,
                      int totalReduces, String jobStatus, boolean uberized) {
  datum.jobid = new Utf8(id.toString());
  datum.launchTime = launchTime;
  datum.totalMaps = totalMaps;
  datum.totalReduces = totalReduces;
  datum.jobStatus = new Utf8(jobStatus);
  datum.uberized = uberized;
}
 
Example 7
Source File: JobSubmittedEvent.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
   * Create an event to record job submission
   * @param id The job Id of the job
   * @param jobName Name of the job
   * @param userName Name of the user who submitted the job
   * @param submitTime Time of submission
   * @param jobConfPath Path of the Job Configuration file
   * @param jobACLs The configured acls for the job.
   * @param jobQueueName The job-queue to which this job was submitted to
   * @param workflowId The Id of the workflow
   * @param workflowName The name of the workflow
   * @param workflowNodeName The node name of the workflow
   * @param workflowAdjacencies The adjacencies of the workflow
   * @param workflowTags Comma-separated tags for the workflow
   */
  public JobSubmittedEvent(JobID id, String jobName, String userName,
      long submitTime, String jobConfPath,
      Map<JobACL, AccessControlList> jobACLs, String jobQueueName,
      String workflowId, String workflowName, String workflowNodeName,
      String workflowAdjacencies, String workflowTags) {
  datum.jobid = new Utf8(id.toString());
  datum.jobName = new Utf8(jobName);
  datum.userName = new Utf8(userName);
  datum.submitTime = submitTime;
  datum.jobConfPath = new Utf8(jobConfPath);
  Map<CharSequence, CharSequence> jobAcls = new HashMap<CharSequence, CharSequence>();
  for (Entry<JobACL, AccessControlList> entry : jobACLs.entrySet()) {
    jobAcls.put(new Utf8(entry.getKey().getAclName()), new Utf8(
        entry.getValue().getAclString()));
  }
  datum.acls = jobAcls;
  if (jobQueueName != null) {
    datum.jobQueueName = new Utf8(jobQueueName);
  }
  if (workflowId != null) {
    datum.workflowId = new Utf8(workflowId);
  }
  if (workflowName != null) {
    datum.workflowName = new Utf8(workflowName);
  }
  if (workflowNodeName != null) {
    datum.workflowNodeName = new Utf8(workflowNodeName);
  }
  if (workflowAdjacencies != null) {
    datum.workflowAdjacencies = new Utf8(workflowAdjacencies);
  }
  if (workflowTags != null) {
    datum.workflowTags = new Utf8(workflowTags);
  }
}
 
Example 8
Source File: BlockIntegrityMonitor.java    From RDFS with Apache License 2.0 4 votes vote down vote up
JobStatus(JobID id, String name, String url) {
  this.id = id == null ? "" : id.toString();
  this.name = name == null ? "" : name;
  this.url = url == null ? "" : url;
}
 
Example 9
Source File: JobQueueChangeEvent.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public JobQueueChangeEvent(JobID id, String queueName) {
  datum.jobid = new Utf8(id.toString());
  datum.jobQueueName = new Utf8(queueName);
}
 
Example 10
Source File: JobPriorityChangeEvent.java    From hadoop with Apache License 2.0 4 votes vote down vote up
/** Generate an event to record changes in Job priority
 * @param id Job Id
 * @param priority The new priority of the job
 */
public JobPriorityChangeEvent(JobID id, JobPriority priority) {
  datum.jobid = new Utf8(id.toString());
  datum.priority = new Utf8(priority.name());
}
 
Example 11
Source File: JobPriorityChangeEvent.java    From big-c with Apache License 2.0 4 votes vote down vote up
/** Generate an event to record changes in Job priority
 * @param id Job Id
 * @param priority The new priority of the job
 */
public JobPriorityChangeEvent(JobID id, JobPriority priority) {
  datum.jobid = new Utf8(id.toString());
  datum.priority = new Utf8(priority.name());
}
 
Example 12
Source File: JobQueueChangeEvent.java    From big-c with Apache License 2.0 4 votes vote down vote up
public JobQueueChangeEvent(JobID id, String queueName) {
  datum.jobid = new Utf8(id.toString());
  datum.jobQueueName = new Utf8(queueName);
}
 
Example 13
Source File: JobStatusChangedEvent.java    From big-c with Apache License 2.0 2 votes vote down vote up
/**
 * Create an event to record the change in the Job Status
 * @param id Job ID
 * @param jobStatus The new job status
 */
public JobStatusChangedEvent(JobID id, String jobStatus) {
  datum.jobid = new Utf8(id.toString());
  datum.jobStatus = new Utf8(jobStatus);
}
 
Example 14
Source File: HadoopUtils.java    From ignite with Apache License 2.0 2 votes vote down vote up
/**
 * Gets job file.
 *
 * @param conf Configuration.
 * @param usr User.
 * @param jobId Job ID.
 * @return Job file.
 */
public static Path jobFile(Configuration conf, String usr, JobID jobId) {
    return new Path(stagingAreaDir(conf, usr), jobId.toString() + Path.SEPARATOR + MRJobConfig.JOB_CONF_FILE);
}
 
Example 15
Source File: JobInfoChangeEvent.java    From big-c with Apache License 2.0 2 votes vote down vote up
/** 
 * Create a event to record the submit and launch time of a job
 * @param id Job Id 
 * @param submitTime Submit time of the job
 * @param launchTime Launch time of the job
 */
public JobInfoChangeEvent(JobID id, long submitTime, long launchTime) {
  datum.jobid = new Utf8(id.toString());
  datum.submitTime = submitTime;
  datum.launchTime = launchTime;
}
 
Example 16
Source File: TaskLog.java    From hadoop with Apache License 2.0 2 votes vote down vote up
/**
 * Get the user log directory for the job jobid.
 * 
 * @param jobid
 * @return user log directory for the job
 */
public static File getJobDir(JobID jobid) {
  return new File(getUserLogDir(), jobid.toString());
}
 
Example 17
Source File: TaskLog.java    From big-c with Apache License 2.0 2 votes vote down vote up
/**
 * Get the user log directory for the job jobid.
 * 
 * @param jobid
 * @return user log directory for the job
 */
public static File getJobDir(JobID jobid) {
  return new File(getUserLogDir(), jobid.toString());
}
 
Example 18
Source File: JobInfoChangeEvent.java    From hadoop with Apache License 2.0 2 votes vote down vote up
/** 
 * Create a event to record the submit and launch time of a job
 * @param id Job Id 
 * @param submitTime Submit time of the job
 * @param launchTime Launch time of the job
 */
public JobInfoChangeEvent(JobID id, long submitTime, long launchTime) {
  datum.jobid = new Utf8(id.toString());
  datum.submitTime = submitTime;
  datum.launchTime = launchTime;
}
 
Example 19
Source File: JobStatusChangedEvent.java    From hadoop with Apache License 2.0 2 votes vote down vote up
/**
 * Create an event to record the change in the Job Status
 * @param id Job ID
 * @param jobStatus The new job status
 */
public JobStatusChangedEvent(JobID id, String jobStatus) {
  datum.jobid = new Utf8(id.toString());
  datum.jobStatus = new Utf8(jobStatus);
}