List of usage examples for org.apache.hadoop.mapreduce JobStatus getJobName
public String getJobName()
From source file:org.apache.ignite.client.hadoop.GridHadoopClientProtocolSelfTest.java
License:Apache License
/** * Check job status.//from w w w . j a v a 2 s.c om * * @param status Job status. * @param expJobId Expected job ID. * @param expJobName Expected job name. * @param expState Expected state. * @param expCleanupProgress Expected cleanup progress. * @throws Exception If failed. */ private static void checkJobStatus(JobStatus status, JobID expJobId, String expJobName, JobStatus.State expState, float expCleanupProgress) throws Exception { assert F.eq(status.getJobID(), expJobId) : "Expected=" + expJobId + ", actual=" + status.getJobID(); assert F.eq(status.getJobName(), expJobName) : "Expected=" + expJobName + ", actual=" + status.getJobName(); assert F.eq(status.getState(), expState) : "Expected=" + expState + ", actual=" + status.getState(); assert F.eq(status.getCleanupProgress(), expCleanupProgress) : "Expected=" + expCleanupProgress + ", actual=" + status.getCleanupProgress(); }
From source file:org.huahinframework.manager.util.JobUtils.java
License:Apache License
/** * @param jobStatus//from w w w .j a va2 s . c o m * @return JSON map * @throws IOException */ public static Map<String, Object> getJob(JobStatus jobStatus) throws IOException { int numUsedSlots = jobStatus.getNumUsedSlots(); int numReservedSlots = jobStatus.getNumReservedSlots(); int usedMem = jobStatus.getUsedMem(); int rsvdMem = jobStatus.getReservedMem(); int neededMem = jobStatus.getNeededMem(); Map<String, Object> m = new HashMap<String, Object>(); m.put(Response.JOBID, jobStatus.getJobID().toString()); m.put(Response.NAME, jobStatus.getJobName()); m.put(Response.STATE, jobStatus.getState()); Calendar startTime = Calendar.getInstance(); startTime.setTimeInMillis(jobStatus.getStartTime()); m.put(Response.START_TIME, startTime.getTime().toString()); m.put(Response.USER, jobStatus.getUsername()); m.put(Response.QUEUE, jobStatus.getQueue()); m.put(Response.PRIORITY, jobStatus.getPriority().name()); m.put(Response.USED_CONTAINERS, numUsedSlots < 0 ? UNAVAILABLE : numUsedSlots); m.put(Response.RSVD_CONTAINERS, numReservedSlots < 0 ? UNAVAILABLE : numReservedSlots); m.put(Response.USED_MEM, usedMem < 0 ? UNAVAILABLE : String.format(memPattern, usedMem)); m.put(Response.RSVD_MEM, rsvdMem < 0 ? UNAVAILABLE : String.format(memPattern, rsvdMem)); m.put(Response.NEEDED_MEM, neededMem < 0 ? UNAVAILABLE : String.format(memPattern, neededMem)); m.put(Response.AM_INFO, jobStatus.getSchedulingInfo()); return m; }