当前位置: 首页>>代码示例>>Java>>正文


Java JobId.setId方法代码示例

本文整理汇总了Java中org.apache.hadoop.mapreduce.v2.api.records.JobId.setId方法的典型用法代码示例。如果您正苦于以下问题:Java JobId.setId方法的具体用法?Java JobId.setId怎么用?Java JobId.setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.mapreduce.v2.api.records.JobId的用法示例。


在下文中一共展示了JobId.setId方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testFromYarnJobReport

import org.apache.hadoop.mapreduce.v2.api.records.JobId; //导入方法依赖的package包/类
@Test
public void testFromYarnJobReport() throws Exception {
  int jobStartTime = 612354;
  int jobFinishTime = 612355;
  JobState state = JobState.RUNNING;
  JobId jobId = Records.newRecord(JobId.class);
  JobReport jobReport = Records.newRecord(JobReport.class);
  ApplicationId applicationId = ApplicationId.newInstance(0, 0);
  jobId.setAppId(applicationId);
  jobId.setId(0);    
  jobReport.setJobId(jobId);
  jobReport.setJobState(state);
  jobReport.setStartTime(jobStartTime);
  jobReport.setFinishTime(jobFinishTime);
  jobReport.setUser("TestTypeConverter-user");    
  JobStatus jobStatus = TypeConverter.fromYarn(jobReport, "dummy-jobfile");
  Assert.assertEquals(jobStartTime, jobStatus.getStartTime());
  Assert.assertEquals(jobFinishTime, jobStatus.getFinishTime());    
  Assert.assertEquals(state.toString(), jobStatus.getState().toString());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestTypeConverter.java

示例2: testPartialJob

import org.apache.hadoop.mapreduce.v2.api.records.JobId; //导入方法依赖的package包/类
/**
 * Simple test PartialJob
 */
@Test(timeout = 3000)
public void testPartialJob() throws Exception {
  JobId jobId = new JobIdPBImpl();
  jobId.setId(0);
  JobIndexInfo jii = new JobIndexInfo(0L, System.currentTimeMillis(), "user",
      "jobName", jobId, 3, 2, "JobStatus");
  PartialJob test = new PartialJob(jii, jobId);
  assertEquals(1.0f, test.getProgress(), 0.001);
  assertNull(test.getAllCounters());
  assertNull(test.getTasks());
  assertNull(test.getTasks(TaskType.MAP));
  assertNull(test.getTask(new TaskIdPBImpl()));

  assertNull(test.getTaskAttemptCompletionEvents(0, 100));
  assertNull(test.getMapAttemptCompletionEvents(0, 100));
  assertTrue(test.checkAccess(UserGroupInformation.getCurrentUser(), null));
  assertNull(test.getAMInfos());

}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:TestJobHistoryParsing.java

示例3: getJob

import org.apache.hadoop.mapreduce.v2.api.records.JobId; //导入方法依赖的package包/类
private Job getJob() {
  Job job = mock(Job.class);

  JobId jobId = new JobIdPBImpl();

  ApplicationId appId = ApplicationIdPBImpl.newInstance(System.currentTimeMillis(),4);
  jobId.setAppId(appId);
  jobId.setId(1);
  when(job.getID()).thenReturn(jobId);

  JobReport report = mock(JobReport.class);
  when(report.getStartTime()).thenReturn(100010L);
  when(report.getFinishTime()).thenReturn(100015L);

  when(job.getReport()).thenReturn(report);
  when(job.getName()).thenReturn("JobName");
  when(job.getUserName()).thenReturn("UserName");
  when(job.getQueueName()).thenReturn("QueueName");
  when(job.getState()).thenReturn(JobState.SUCCEEDED);
  when(job.getTotalMaps()).thenReturn(3);
  when(job.getCompletedMaps()).thenReturn(2);
  when(job.getTotalReduces()).thenReturn(2);
  when(job.getCompletedReduces()).thenReturn(1);
  when(job.getCompletedReduces()).thenReturn(1);
  return job;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:TestBlocks.java

示例4: getTask

import org.apache.hadoop.mapreduce.v2.api.records.JobId; //导入方法依赖的package包/类
private Task getTask(long timestamp) {
  
  JobId jobId = new JobIdPBImpl();
  jobId.setId(0);
  jobId.setAppId(ApplicationIdPBImpl.newInstance(timestamp,1));

  TaskId taskId = new TaskIdPBImpl();
  taskId.setId(0);
  taskId.setTaskType(TaskType.REDUCE);
  taskId.setJobId(jobId);
  Task task = mock(Task.class);
  when(task.getID()).thenReturn(taskId);
  TaskReport report = mock(TaskReport.class);
  when(report.getProgress()).thenReturn(0.7f);
  when(report.getTaskState()).thenReturn(TaskState.SUCCEEDED);
  when(report.getStartTime()).thenReturn(100001L);
  when(report.getFinishTime()).thenReturn(100011L);

  when(task.getReport()).thenReturn(report);
  when(task.getType()).thenReturn(TaskType.REDUCE);
  return task;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:TestBlocks.java

示例5: toYarn

import org.apache.hadoop.mapreduce.v2.api.records.JobId; //导入方法依赖的package包/类
public static JobId toYarn(org.apache.hadoop.mapreduce.JobID id) {
  JobId jobId = recordFactory.newRecordInstance(JobId.class);
  jobId.setId(id.getId()); //currently there is 1-1 mapping between appid and jobid

  ApplicationId appId = ApplicationId.newInstance(
      toClusterTimeStamp(id.getJtIdentifier()), id.getId());
  jobId.setAppId(appId);
  return jobId;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:TypeConverter.java

示例6: testTasksBlock

import org.apache.hadoop.mapreduce.v2.api.records.JobId; //导入方法依赖的package包/类
/**
 * Test rendering for TasksBlock
 */
@Test
public void testTasksBlock() throws Exception {

  ApplicationId appId = ApplicationIdPBImpl.newInstance(0, 1);
  JobId jobId = new JobIdPBImpl();
  jobId.setId(0);
  jobId.setAppId(appId);

  TaskId taskId = new TaskIdPBImpl();
  taskId.setId(0);
  taskId.setTaskType(TaskType.MAP);
  taskId.setJobId(jobId);
  Task task = mock(Task.class);
  when(task.getID()).thenReturn(taskId);
  TaskReport report = mock(TaskReport.class);
  when(report.getProgress()).thenReturn(0.7f);
  when(report.getTaskState()).thenReturn(TaskState.SUCCEEDED);
  when(report.getStartTime()).thenReturn(100001L);
  when(report.getFinishTime()).thenReturn(100011L);
  when(report.getStatus()).thenReturn("Dummy Status \n*");


  when(task.getReport()).thenReturn(report);
  when(task.getType()).thenReturn(TaskType.MAP);


  Map<TaskId, Task> tasks = new HashMap<TaskId, Task>();
  tasks.put(taskId, task);
  AppContext ctx = mock(AppContext.class);
  Job job = mock(Job.class);
  when(job.getTasks()).thenReturn(tasks);


  App app = new App(ctx);
  app.setJob(job);
  TasksBlockForTest taskBlock = new TasksBlockForTest(app);
  taskBlock.addParameter(AMParams.TASK_TYPE, "m");

  PrintWriter pWriter = new PrintWriter(data);
  Block html = new BlockForTest(new HtmlBlockForTest(), pWriter, 0, false);

  taskBlock.render(html);
  pWriter.flush();
  assertTrue(data.toString().contains("task_0_0001_m_000000"));
  assertTrue(data.toString().contains("70.00"));
  assertTrue(data.toString().contains("SUCCEEDED"));
  assertTrue(data.toString().contains("100001"));
  assertTrue(data.toString().contains("100011"));
  assertFalse(data.toString().contains("Dummy Status \n*"));
  assertTrue(data.toString().contains("Dummy Status \\n*"));


}
 
开发者ID:naver,项目名称:hadoop,代码行数:57,代码来源:TestBlocks.java

示例7: newJobID

import org.apache.hadoop.mapreduce.v2.api.records.JobId; //导入方法依赖的package包/类
public static JobId newJobID(ApplicationId appID, int i) {
  JobId id = Records.newRecord(JobId.class);
  id.setAppId(appID);
  id.setId(i);
  return id;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:7,代码来源:MockJobs.java

示例8: newJobId

import org.apache.hadoop.mapreduce.v2.api.records.JobId; //导入方法依赖的package包/类
public static JobId newJobId(ApplicationId appId, int id) {
  JobId jobId = Records.newRecord(JobId.class);
  jobId.setAppId(appId);
  jobId.setId(id);
  return jobId;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:7,代码来源:MRBuilderUtils.java

示例9: createJobId

import org.apache.hadoop.mapreduce.v2.api.records.JobId; //导入方法依赖的package包/类
private static JobId createJobId(int id) {
  JobId jobId = new JobIdPBImpl();
  jobId.setId(id);
  jobId.setAppId(ApplicationIdPBImpl.newInstance(0, id));
  return jobId;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:7,代码来源:TestUnnecessaryBlockingOnHistoryFileInfo.java


注:本文中的org.apache.hadoop.mapreduce.v2.api.records.JobId.setId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。