@Test(timeout = 10000) public void testJobQueueChange() throws Exception { org.apache.hadoop.mapreduce.JobID jid = new JobID("001", 1); JobQueueChangeEvent test = new JobQueueChangeEvent(jid, "newqueue"); assertEquals(test.getJobId().toString(), jid.toString()); assertEquals(test.getJobQueueName(), "newqueue"); }
/** * simple test JobPriorityChangeEvent and JobPriorityChange * * @throws Exception */ @Test(timeout = 10000) public void testJobPriorityChange() throws Exception { org.apache.hadoop.mapreduce.JobID jid = new JobID("001", 1); JobPriorityChangeEvent test = new JobPriorityChangeEvent(jid, JobPriority.LOW); assertEquals(test.getJobId().toString(), jid.toString()); assertEquals(test.getPriority(), JobPriority.LOW); }
public static String getJobFile( Configuration conf, String user, org.apache.hadoop.mapreduce.JobID jobId) { Path jobFile = new Path( MRApps.getStagingAreaDir(conf, user), jobId.toString() + Path.SEPARATOR + MRJobConfig.JOB_CONF_FILE); return jobFile.toString(); }
/** * Get the user log directory for the job jobid. * * @param jobid the jobid object * @return user log directory for the job */ public static File getJobDir(JobID jobid) { return getJobDir(jobid.toString()); }
public void test( String workflowId, String workflowName, String workflowNodeName, Map<String, String[]> adjacencies) { Configuration conf = new Configuration(); setProperties(conf, workflowId, workflowName, workflowNodeName, adjacencies); String log = log( "JOB", new String[] {ID, NAME, NODE, ADJ}, new String[] { conf.get(ID_PROP), conf.get(NAME_PROP), conf.get(NODE_PROP), JobHistory.JobInfo.getWorkflowAdjacencies(conf) }); ParsedLine line = new ParsedLine(log); JobID jobid = new JobID("id", 1); JobSubmittedEvent event = new JobSubmittedEvent( jobid, workflowName, "", 0l, "", null, "", line.get(ID), line.get(NAME), line.get(NODE), line.get(ADJ)); WorkflowContext context = MapReduceJobHistoryUpdater.buildWorkflowContext(event); String resultingWorkflowId = workflowId; if (workflowId.isEmpty()) resultingWorkflowId = jobid.toString().replace("job_", "mr_"); assertEquals("Didn't recover workflowId", resultingWorkflowId, context.getWorkflowId()); assertEquals("Didn't recover workflowName", workflowName, context.getWorkflowName()); assertEquals( "Didn't recover workflowNodeName", workflowNodeName, context.getWorkflowEntityName()); Map<String, String[]> resultingAdjacencies = adjacencies; if (resultingAdjacencies.size() == 0) { resultingAdjacencies = new HashMap<String, String[]>(); resultingAdjacencies.put(workflowNodeName, new String[] {}); } assertEquals( "Got incorrect number of adjacencies", resultingAdjacencies.size(), context.getWorkflowDag().getEntries().size()); for (WorkflowDagEntry entry : context.getWorkflowDag().getEntries()) { String[] sTargets = resultingAdjacencies.get(entry.getSource()); assertNotNull("No original targets for " + entry.getSource(), sTargets); List<String> dTargets = entry.getTargets(); assertEquals( "Got incorrect number of targets for " + entry.getSource(), sTargets.length, dTargets.size()); for (int i = 0; i < sTargets.length; i++) { assertEquals("Got incorrect target for " + entry.getSource(), sTargets[i], dTargets.get(i)); } } }
public static Path getJobPath(JobID jobID, Path workingDirectory) { return new Path(workingDirectory, jobID.toString()); }