List of usage examples for org.apache.hadoop.mapred JobID toString
@Override
public String toString()
From source file:com.impetus.ankush2.hadoop.monitor.JobStatusProvider.java
License:Open Source License
/** * @param jobClient/*from ww w .ja va 2 s. co m*/ * @param jobSts * @return * @throws IOException */ private Map<String, Object> getJobReport(JobStatus jobSts) throws IOException { // Creating an empty map for storing job information Map<String, Object> jobReport = new HashMap<String, Object>(); // Returns the jobid of the Job org.apache.hadoop.mapred.JobID jobId = jobSts.getJobID(); // Get an RunningJob object to track an ongoing Map-Reduce // job. RunningJob job = jobClient.getJob(jobId); String jobName = ""; if (job != null) { // Get the name of the job. jobName = job.getJobName(); } // Percentage of progress in maps float mapProgress = jobSts.mapProgress() * 100; // Percentage of progress in reduce float reduceProgress = jobSts.reduceProgress() * 100; int mapTotal = 0; int reduceTotal = 0; int mapComp = 0; int reduceComp = 0; // Count for Map and Reduce Complete try { // Get the information of the current state of the map // tasks of a job TaskReport[] mapTaskReports = jobClient.getMapTaskReports(jobId); // Get the total map mapTotal = mapTaskReports.length; // Iterating over the map tasks for (TaskReport taskReport : mapTaskReports) { // The current state of a map TaskInProgress as seen // by the JobTracker. TIPStatus currentStatus = taskReport.getCurrentStatus(); if (currentStatus == TIPStatus.COMPLETE) { mapComp++; } } // Get the information of the current state of the // reduce tasks of a job. TaskReport[] reduceTaskReport = jobClient.getReduceTaskReports(jobId); // Get the total reduce reduceTotal = reduceTaskReport.length; // Iterating over the reduce tasks for (TaskReport taskReport : reduceTaskReport) { // The current state of a reduce TaskInProgress as // seen by the JobTracker. TIPStatus currentStatus = taskReport.getCurrentStatus(); if (currentStatus == TIPStatus.COMPLETE) { reduceComp++; } } } catch (Exception e) { LOG.error(e.getMessage(), e); } // Percentage of progress in setup float setupProgress = jobSts.setupProgress() * 100; // The progress made on cleanup float cleanupProgress = jobSts.cleanupProgress() * 100; // gets any available info on the reason of failure of the // job..Returns the diagnostic information on why a job // might have failed. String failureInfo = jobSts.getFailureInfo(); // Putting Job Sttaus information in map jobReport.put("jobId", jobId.toString()); jobReport.put("jobName", jobName); jobReport.put("jobPriority", jobSts.getJobPriority().toString()); jobReport.put("jobStartTime", jobSts.getStartTime()); jobReport.put("userName", jobSts.getUsername()); jobReport.put("jobComplete", jobSts.isJobComplete()); jobReport.put("mapProgress", mapProgress); jobReport.put("reduceProgress", reduceProgress); jobReport.put("mapTotal", mapTotal); jobReport.put("reduceTotal", reduceTotal); jobReport.put("mapCompleted", mapComp); jobReport.put("reduceCompleted", reduceComp); jobReport.put("setupProgress", setupProgress); jobReport.put("cleanupProgress", cleanupProgress); jobReport.put("schedulingInfo", jobSts.getSchedulingInfo()); jobReport.put("jobState", JobStatus.getJobRunState(jobSts.getRunState())); jobReport.put("failureInfo", failureInfo); jobReport.put("jobFile", job.getJobFile()); jobReport.put("trackingURL", job.getTrackingURL()); jobReport.putAll(getDetailedJobReport(jobId)); return jobReport; }
From source file:com.mellanox.hadoop.mapred.UdaPluginSH.java
License:Apache License
public void addJob(String user, JobID jobId) { userRsrc.put(jobId.toString(), user); }
From source file:com.mellanox.hadoop.mapred.UdaPluginSH.java
License:Apache License
public void removeJob(JobID jobId) { userRsrc.remove(jobId.toString()); }
From source file:edu.stolaf.cs.wmrserver.HadoopEngine.java
License:Apache License
private RunningJob getJob(Submission submission) throws NotFoundException, InternalException { if (!submission.isSubmitted()) throw new NotFoundException("Job with specified ID exists, but was not submitted to Hadoop."); JobID requestedID; try {/*from www . j a v a2 s .c o m*/ requestedID = JobID.forName(submission.getHadoopID()); } catch (IllegalArgumentException ex) { throw JobServiceHandler.wrapException("Hadoop Job ID was malformed.", ex); } RunningJob job; try { JobClient client = new JobClient(new JobConf()); job = client.getJob(requestedID); } catch (Exception ex) { throw JobServiceHandler.wrapException("Could not get Hadoop job.", ex); } if (job == null) throw new NotFoundException("The job specifed by ID \"" + requestedID.toString() + "\" was not found."); return job; }
From source file:hivemall.utils.hadoop.HadoopUtils.java
License:Open Source License
@Nonnull public static String getJobIdFromTaskId(@Nonnull String taskidStr) { if (!taskidStr.startsWith("task_")) {// workaround for Tez taskidStr = taskidStr.replace("task", "task_"); taskidStr = taskidStr.substring(0, taskidStr.lastIndexOf('_')); }/* www . jav a 2 s .com*/ TaskID taskId = TaskID.forName(taskidStr); JobID jobId = taskId.getJobID(); return jobId.toString(); }
From source file:org.godhuli.rhipe.FileUtils.java
License:Apache License
public long getStart(org.apache.hadoop.mapred.JobClient jc, org.apache.hadoop.mapred.JobID jj) throws Exception { //this is not needed if i can get a reference to JobTracker (which rtruns the JobStatus for a given JobID) org.apache.hadoop.mapred.JobStatus[] jbs = jc.getAllJobs(); for (int i = 0; i < jbs.length; i++) { if (jbs[i].getJobID().toString().equals(jj.toString())) { return (jbs[i].getStartTime()); }/*from www . ja va 2s. co m*/ } return (0); }
From source file:skewtune.mapreduce.STJobTracker.java
License:Apache License
Path getSystemDirectoryForJob(org.apache.hadoop.mapreduce.JobID id) { return new Path(getSystemDir(), id.toString()); }
From source file:skewtune.mapreduce.STJobTracker.java
License:Apache License
@Override public void killJob(JobID jobid) throws IOException, InterruptedException { JobInProgress jip = null;/*from ww w . j a v a 2s .c o m*/ synchronized (jobs) { jip = jobs.get(jobid); } if (jip == null) { LOG.warn("Unknown jobid: " + jobid.toString()); } else { jip.kill(true, pendingCompletedReactiveJob); } }