private void checkAllTriggers() throws TriggerManagerException { // sweep through the rest of them for (final Trigger t : this.triggers) { try { TriggerManager.this.scannerStage = "Checking for trigger " + t.getTriggerId(); if (t.getStatus().equals(TriggerStatus.READY)) { /** * Prior to this change, expiration condition should never be called though * we have some related code here. ExpireCondition used the same BasicTimeChecker * as triggerCondition do. As a consequence, we need to figure out a way to distinguish * the previous ExpireCondition and this commit's ExpireCondition. */ if (t.getExpireCondition().getExpression().contains("EndTimeChecker") && t .expireConditionMet()) { onTriggerPause(t); } else if (t.triggerConditionMet()) { onTriggerTrigger(t); } } if (t.getStatus().equals(TriggerStatus.EXPIRED) && t.getSource().equals("azkaban")) { removeTrigger(t); } else { t.updateNextCheckTime(); } } catch (final Throwable th) { //skip this trigger, moving on to the next one logger.error("Failed to process trigger with id : " + t, th); } } }
@Test public void timeCheckerAndExpireTriggerTest() throws TriggerManagerException { final long curr = System.currentTimeMillis(); final Trigger t1 = createPeriodAndEndCheckerTrigger(curr); this.triggerManager.insertTrigger(t1); t1.setResetOnTrigger(true); final BasicTimeChecker expireChecker = (BasicTimeChecker) t1.getExpireCondition().getCheckers().values() .toArray()[0]; sleep(1000); assertTrue(expireChecker.eval() == false); assertTrue(t1.getStatus() == TriggerStatus.READY); sleep(1000); sleep(1000); sleep(1000); assertTrue(expireChecker.eval() == true); assertTrue(t1.getStatus() == TriggerStatus.PAUSED); sleep(1000); assertTrue(expireChecker.eval() == true); assertTrue(t1.getStatus() == TriggerStatus.PAUSED); }
act.getProjectName(), act.getFlowName(), t.getStatus().toString(), triggerTimeChecker.getFirstCheckTime(), endTimeChecker == null ? Constants.DEFAULT_SCHEDULE_END_EPOCH_TIME
private void checkAllTriggers() throws TriggerManagerException { // sweep through the rest of them for (final Trigger t : this.triggers) { try { TriggerManager.this.scannerStage = "Checking for trigger " + t.getTriggerId(); if (t.getStatus().equals(TriggerStatus.READY)) { /** * Prior to this change, expiration condition should never be called though * we have some related code here. ExpireCondition used the same BasicTimeChecker * as triggerCondition do. As a consequence, we need to figure out a way to distinguish * the previous ExpireCondition and this commit's ExpireCondition. */ if (t.getExpireCondition().getExpression().contains("EndTimeChecker") && t .expireConditionMet()) { onTriggerPause(t); } else if (t.triggerConditionMet()) { onTriggerTrigger(t); } } if (t.getStatus().equals(TriggerStatus.EXPIRED) && t.getSource().equals("azkaban")) { removeTrigger(t); } else { t.updateNextCheckTime(); } } catch (final Throwable th) { //skip this trigger, moving on to the next one logger.error("Failed to process trigger with id : " + t, th); } } }
act.getProjectName(), act.getFlowName(), t.getStatus().toString(), ck.getFirstCheckTime(), ck.getTimeZone(),
act.getProjectName(), act.getFlowName(), t.getStatus().toString(), triggerTimeChecker.getFirstCheckTime(), endTimeChecker == null ? Constants.DEFAULT_SCHEDULE_END_EPOCH_TIME