private void notifyEventService(SchedulerAlarmEvent alarmEvent, boolean shouldWait) throws LensException, InterruptedException { LensEventService eventService = LensServices.get().getService(LensEventService.NAME); if (shouldWait) { eventService.notifyEventSync(alarmEvent); } else { eventService.notifyEvent(alarmEvent); } }
protected void notifyEvent(LensEvent event) throws LensException { getEventService().notifyEvent(event); }
private void notifyRerun(SchedulerJobInstanceInfo instanceInfo) throws LensException { getEventService().notifyEvent( new SchedulerAlarmEvent(instanceInfo.getJobId(), new DateTime(instanceInfo.getScheduleTime()), SchedulerAlarmEvent.EventType.SCHEDULE, instanceInfo.getId())); }
/** * Accept. * * @param query the query * @param conf the conf * @param submitOp the submit op * @throws LensException the lens exception */ private void accept(String query, Configuration conf, SubmitOp submitOp) throws LensException { // run through all the query acceptors, and throw Exception if any of them // return false for (QueryAcceptor acceptor : queryAcceptors) { String cause = ""; String rejectionCause = acceptor.accept(query, conf, submitOp); if (rejectionCause != null) { getEventService().notifyEvent(new QueryRejected(System.currentTimeMillis(), query, rejectionCause, null)); throw new BadRequestException("Query not accepted because " + cause); } } getEventService().notifyEvent(new QueryAccepted(System.currentTimeMillis(), null, query, null)); }
@Override public void run() { try { final String runId = UUID.randomUUID().toString(); this.logSegregationContext.setLogSegregationId(runId); for (Map.Entry<String, String> entry : scanSet.entrySet()) { File f = new File(entry.getValue()).getAbsoluteFile(); String fileName = f.getAbsolutePath(); File[] latestLogFiles = getLatestLogFile(fileName); HashMap<String, String> partMap = getPartMap(fileName, latestLogFiles); String eventName = entry.getKey(); PartitionEvent event = new PartitionEvent(eventName, partMap, classSet.get(eventName)); try { service.notifyEvent(event); } catch (LensException e) { log.warn("Unable to Notify partition event {} with map {}", event.getEventName(), event.getPartMap()); } } } catch (Exception exc) { MetricsService svc = LensServices.get().getService(MetricsService.NAME); svc.incrCounter(StatisticsLogFileScannerTask.class, LOG_SCANNER_ERRORS); log.error("Unknown error in log file scanner ", exc); } }
@Override public void run() { while (!Thread.currentThread().isInterrupted()) { // Get all the instance runs which are waiting. List<SchedulerJobInstanceRun> instanceRuns = schedulerDAO.getInstanceRuns(SchedulerJobInstanceState.WAITING); for (SchedulerJobInstanceRun run : instanceRuns) { SchedulerJobInstanceInfo instanceInfo = schedulerDAO.getSchedulerJobInstanceInfo(run.getHandle()); try { run.setInstanceState(run.getInstanceState().nextTransition(ON_PREPARE)); run.setEndTime(System.currentTimeMillis()); schedulerDAO.updateJobInstanceRun(run); eventService.notifyEvent( new SchedulerAlarmEvent(instanceInfo.getJobId(), new DateTime(instanceInfo.getScheduleTime()), SchedulerAlarmEvent.EventType.SCHEDULE, instanceInfo.getId())); } catch (LensException e) { log.error("Not able to notify schedule event for job {} and instanceId {}", instanceInfo.getJobId(), instanceInfo.getId()); } catch (InvalidStateTransitionException e) { log.error("Wrong state transition", e); } } } try { Thread.sleep(delay); } catch (InterruptedException e) { log.warn("Thread WaitingInstanceHandler was inerrupted", e); } } }
return null; }).when(service).notifyEvent(Mockito.any(PartitionEvent.class)); } catch (Exception e) { log.error("Error while running test.", e);
getEventService().notifyEvent(event); } catch (LensException e) { log.warn("LensEventService encountered error while handling event: {}", event.getEventId(), e);
getEventService().notifyEvent(newStatusChangeEvent(ctx, null, ctx.getStatus().getStatus())); } catch (LensException e) { log.error("Couldn't notify event for query executed for {}", ctx, e);
LOG.debug("Notifying Statistics " + event); eventService.notifyEvent(event); } catch (LensException e) { LOG.warn("Unable to notify Execution statistics", e);