本文整理了Java中org.apache.hadoop.mapred.jobcontrol.Job.setJob()
方法的一些代码示例,展示了Job.setJob()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Job.setJob()
方法的具体详情如下:
包路径:org.apache.hadoop.mapred.jobcontrol.Job
类名称:Job
方法名:setJob
[英]Set the mapred job conf for this job.
[中]设置此作业的映射作业配置。
代码示例来源:origin: org.apache.hadoop/hadoop-mapred-test
public void testGetAssignedJobId() throws Exception {
JobConf jc = new JobConf();
Job j = new Job(jc);
//Just make sure no exception is thrown
assertNull(j.getAssignedJobID());
org.apache.hadoop.mapreduce.Job mockjob = mock(org.apache.hadoop.mapreduce.Job.class);
org.apache.hadoop.mapreduce.JobID jid = new org.apache.hadoop.mapreduce.JobID("test",0);
when(mockjob.getJobID()).thenReturn(jid);
j.setJob(mockjob);
JobID expected = new JobID("test",0);
assertEquals(expected, j.getAssignedJobID());
verify(mockjob).getJobID();
}
代码示例来源:origin: ch.cern.hadoop/hadoop-mapreduce-client-jobclient
@Test (timeout = 30000)
public void testGetAssignedJobId() throws Exception {
JobConf jc = new JobConf();
Job j = new Job(jc);
//Just make sure no exception is thrown
assertNull(j.getAssignedJobID());
org.apache.hadoop.mapreduce.Job mockjob = mock(org.apache.hadoop.mapreduce.Job.class);
org.apache.hadoop.mapreduce.JobID jid = new org.apache.hadoop.mapreduce.JobID("test",0);
when(mockjob.getJobID()).thenReturn(jid);
j.setJob(mockjob);
JobID expected = new JobID("test",0);
assertEquals(expected, j.getAssignedJobID());
verify(mockjob).getJobID();
}
代码示例来源:origin: ch.cern.hadoop/hadoop-mapreduce-client-jobclient
@SuppressWarnings("deprecation")
@Test(timeout = 30000)
public void testJobState() throws Exception {
Job job_1 = getCopyJob();
JobControl jc = new JobControl("Test");
jc.addJob(job_1);
Assert.assertEquals(Job.WAITING, job_1.getState());
job_1.setState(Job.SUCCESS);
Assert.assertEquals(Job.WAITING, job_1.getState());
org.apache.hadoop.mapreduce.Job mockjob =
mock(org.apache.hadoop.mapreduce.Job.class);
org.apache.hadoop.mapreduce.JobID jid =
new org.apache.hadoop.mapreduce.JobID("test", 0);
when(mockjob.getJobID()).thenReturn(jid);
job_1.setJob(mockjob);
Assert.assertEquals("job_test_0000", job_1.getMapredJobID());
job_1.setMapredJobID("job_test_0001");
Assert.assertEquals("job_test_0000", job_1.getMapredJobID());
jc.stop();
}
内容来源于网络,如有侵权,请联系作者删除!