Java Code Examples for org.apache.hadoop.yarn.event.Dispatcher#getEventHandler()

The following examples show how to use org.apache.hadoop.yarn.event.Dispatcher#getEventHandler() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestJobImpl.java    From hadoop with Apache License 2.0 6 votes vote down vote up
private static StubbedJob createStubbedJob(Configuration conf,
    Dispatcher dispatcher, int numSplits, AppContext appContext) {
  JobID jobID = JobID.forName("job_1234567890000_0001");
  JobId jobId = TypeConverter.toYarn(jobID);
  if (appContext == null) {
    appContext = mock(AppContext.class);
    when(appContext.hasSuccessfullyUnregistered()).thenReturn(true);
  }
  StubbedJob job = new StubbedJob(jobId,
      ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 0), 0),
      conf,dispatcher.getEventHandler(), true, "somebody", numSplits, appContext);
  dispatcher.register(JobEventType.class, job);
  EventHandler mockHandler = mock(EventHandler.class);
  dispatcher.register(TaskEventType.class, mockHandler);
  dispatcher.register(org.apache.hadoop.mapreduce.jobhistory.EventType.class,
      mockHandler);
  dispatcher.register(JobFinishEvent.Type.class, mockHandler);
  return job;
}
 
Example 2
Source File: TestJobImpl.java    From big-c with Apache License 2.0 6 votes vote down vote up
private static StubbedJob createStubbedJob(Configuration conf,
    Dispatcher dispatcher, int numSplits, AppContext appContext) {
  JobID jobID = JobID.forName("job_1234567890000_0001");
  JobId jobId = TypeConverter.toYarn(jobID);
  if (appContext == null) {
    appContext = mock(AppContext.class);
    when(appContext.hasSuccessfullyUnregistered()).thenReturn(true);
  }
  StubbedJob job = new StubbedJob(jobId,
      ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 0), 0),
      conf,dispatcher.getEventHandler(), true, "somebody", numSplits, appContext);
  dispatcher.register(JobEventType.class, job);
  EventHandler mockHandler = mock(EventHandler.class);
  dispatcher.register(TaskEventType.class, mockHandler);
  dispatcher.register(org.apache.hadoop.mapreduce.jobhistory.EventType.class,
      mockHandler);
  dispatcher.register(JobFinishEvent.Type.class, mockHandler);
  return job;
}
 
Example 3
Source File: ContainerAllocationExpirer.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public ContainerAllocationExpirer(Dispatcher d) {
  super(ContainerAllocationExpirer.class.getName(), new SystemClock());
  this.dispatcher = d.getEventHandler();
}
 
Example 4
Source File: AMLivelinessMonitor.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public AMLivelinessMonitor(Dispatcher d) {
  super("AMLivelinessMonitor", new SystemClock());
  this.dispatcher = d.getEventHandler();
}
 
Example 5
Source File: AMLivelinessMonitor.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public AMLivelinessMonitor(Dispatcher d, Clock clock) {
  super("AMLivelinessMonitor", clock);
  this.dispatcher = d.getEventHandler();
}
 
Example 6
Source File: NMLivelinessMonitor.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public NMLivelinessMonitor(Dispatcher d) {
  super("NMLivelinessMonitor", new SystemClock());
  this.dispatcher = d.getEventHandler();
}
 
Example 7
Source File: ContainerAllocationExpirer.java    From big-c with Apache License 2.0 4 votes vote down vote up
public ContainerAllocationExpirer(Dispatcher d) {
  super(ContainerAllocationExpirer.class.getName(), new SystemClock());
  this.dispatcher = d.getEventHandler();
}
 
Example 8
Source File: AMLivelinessMonitor.java    From big-c with Apache License 2.0 4 votes vote down vote up
public AMLivelinessMonitor(Dispatcher d) {
  super("AMLivelinessMonitor", new SystemClock());
  this.dispatcher = d.getEventHandler();
}
 
Example 9
Source File: AMLivelinessMonitor.java    From big-c with Apache License 2.0 4 votes vote down vote up
public AMLivelinessMonitor(Dispatcher d, Clock clock) {
  super("AMLivelinessMonitor", clock);
  this.dispatcher = d.getEventHandler();
}
 
Example 10
Source File: NMLivelinessMonitor.java    From big-c with Apache License 2.0 4 votes vote down vote up
public NMLivelinessMonitor(Dispatcher d) {
  super("NMLivelinessMonitor", new SystemClock());
  this.dispatcher = d.getEventHandler();
}
 
Example 11
Source File: SessionLivelinessMonitor.java    From tajo with Apache License 2.0 4 votes vote down vote up
public SessionLivelinessMonitor(Dispatcher d) {
  super(SessionLivelinessMonitor.class.getSimpleName(), new SystemClock());
  this.dispatcher = d.getEventHandler();
}
 
Example 12
Source File: NodeLivelinessMonitor.java    From tajo with Apache License 2.0 4 votes vote down vote up
public NodeLivelinessMonitor(Dispatcher d) {
  super(NodeLivelinessMonitor.class.getSimpleName(), new SystemClock());
  this.dispatcher = d.getEventHandler();
}
 
Example 13
Source File: WorkerLivelinessMonitor.java    From incubator-tajo with Apache License 2.0 4 votes vote down vote up
public WorkerLivelinessMonitor(Dispatcher d) {
  super(WorkerLivelinessMonitor.class.getSimpleName(), new SystemClock());
  this.dispatcher = d.getEventHandler();
}