本文整理了Java中azkaban.utils.Utils.parsePeriodString()
方法的一些代码示例,展示了Utils.parsePeriodString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.parsePeriodString()
方法的具体详情如下:
包路径:azkaban.utils.Utils
类名称:Utils
方法名:parsePeriodString
暂无
代码示例来源:origin: azkaban/azkaban
public static BasicTimeChecker createFromJson(final HashMap<String, Object> obj)
throws Exception {
final Map<String, Object> jsonObj = (HashMap<String, Object>) obj;
if (!jsonObj.get("type").equals(type)) {
throw new Exception("Cannot create checker of " + type + " from "
+ jsonObj.get("type"));
}
final Long firstCheckTime = Long.valueOf((String) jsonObj.get("firstCheckTime"));
final String timezoneId = (String) jsonObj.get("timezone");
final long nextCheckTime = Long.valueOf((String) jsonObj.get("nextCheckTime"));
final DateTimeZone timezone = DateTimeZone.forID(timezoneId);
final boolean isRecurring = Boolean.valueOf((String) jsonObj.get("isRecurring"));
final boolean skipPastChecks =
Boolean.valueOf((String) jsonObj.get("skipPastChecks"));
final ReadablePeriod period =
Utils.parsePeriodString((String) jsonObj.get("period"));
final String id = (String) jsonObj.get("id");
final String cronExpression = (String) jsonObj.get("cronExpression");
final BasicTimeChecker checker =
new BasicTimeChecker(id, firstCheckTime, timezone, nextCheckTime,
isRecurring, skipPastChecks, period, cronExpression);
if (skipPastChecks) {
checker.updateNextCheckTime();
}
return checker;
}
代码示例来源:origin: azkaban/azkaban
if (this.checkTime < flow.getStartTime()) {
final ReadablePeriod duration =
Utils.parsePeriodString((String) this.slaOption.getInfo().get(
SlaOption.INFO_DURATION));
final DateTime startTime = new DateTime(flow.getStartTime());
if (this.checkTime < flow.getStartTime()) {
final ReadablePeriod duration =
Utils.parsePeriodString((String) this.slaOption.getInfo().get(
SlaOption.INFO_DURATION));
final DateTime startTime = new DateTime(flow.getStartTime());
Utils.parsePeriodString((String) this.slaOption.getInfo().get(
SlaOption.INFO_DURATION));
final DateTime startTime = new DateTime(node.getStartTime());
Utils.parsePeriodString((String) this.slaOption.getInfo().get(
SlaOption.INFO_DURATION));
final DateTime startTime = new DateTime(node.getStartTime());
代码示例来源:origin: azkaban/azkaban
if (this.checkTime < flow.getStartTime()) {
final ReadablePeriod duration =
Utils.parsePeriodString((String) this.slaOption.getInfo().get(
SlaOption.INFO_DURATION));
final DateTime startTime = new DateTime(flow.getStartTime());
if (this.checkTime < flow.getStartTime()) {
final ReadablePeriod duration =
Utils.parsePeriodString((String) this.slaOption.getInfo().get(
SlaOption.INFO_DURATION));
final DateTime startTime = new DateTime(flow.getStartTime());
Utils.parsePeriodString((String) this.slaOption.getInfo().get(
SlaOption.INFO_DURATION));
final DateTime startTime = new DateTime(node.getStartTime());
Utils.parsePeriodString((String) this.slaOption.getInfo().get(
SlaOption.INFO_DURATION));
final DateTime startTime = new DateTime(node.getStartTime());
代码示例来源:origin: azkaban/azkaban
private Trigger createTrigger(final String projName, final String flowName, final String source) {
final DateTime now = DateTime.now();
final ConditionChecker checker1 =
new BasicTimeChecker("timeChecker1", now.getMillis(), now.getZone(),
true, true, Utils.parsePeriodString("1h"), null);
final Map<String, ConditionChecker> checkers1 =
new HashMap<>();
checkers1.put(checker1.getId(), checker1);
final String expr1 = checker1.getId() + ".eval()";
final Condition triggerCond = new Condition(checkers1, expr1);
final Condition expireCond = new Condition(checkers1, expr1);
final List<TriggerAction> actions = new ArrayList<>();
final TriggerAction action =
new ExecuteFlowAction("executeAction", 1, projName, flowName,
"azkaban", new ExecutionOptions(), null);
actions.add(action);
return new Trigger.TriggerBuilder("azkaban",
source,
triggerCond,
expireCond,
actions)
.build();
}
代码示例来源:origin: azkaban/azkaban
now.getZone(), true, true, Utils.parsePeriodString(period), null);
System.out.println("checker id is " + timeChecker.getId());
代码示例来源:origin: azkaban/azkaban
private Trigger createPeriodAndEndCheckerTrigger(final long currMillis) {
final Map<String, ConditionChecker> triggerCheckers = new HashMap<>();
final Map<String, ConditionChecker> expireCheckers = new HashMap<>();
// TODO kunkun-tang: 1 second is the minimum unit for {@link org.joda.time.ReadablePeriod}.
// In future, we should use some smaller alternative.
final ConditionChecker triggerChecker = new BasicTimeChecker("BasicTimeChecker_1",
currMillis, DateTimeZone.UTC, true, true,
Utils.parsePeriodString("1s"), null);
// End time is 3 seconds past now.
final ConditionChecker endTimeChecker = new BasicTimeChecker("EndTimeChecker_1", 111L,
DateTimeZone.UTC, currMillis + 3000L, false, false,
null, null);
triggerCheckers.put(triggerChecker.getId(), triggerChecker);
expireCheckers.put(endTimeChecker.getId(), endTimeChecker);
final String triggerExpr = triggerChecker.getId() + ".eval()";
final String expireExpr = endTimeChecker.getId() + ".eval()";
final Condition triggerCond = new Condition(triggerCheckers, triggerExpr);
final Condition expireCond = new Condition(expireCheckers, expireExpr);
final Trigger timeTrigger = new Trigger.TriggerBuilder("azkaban",
"",
triggerCond,
expireCond,
getTriggerActions()).build();
timeTrigger.setResetOnTrigger(false);
timeTrigger.setResetOnExpire(true);
return timeTrigger;
}
代码示例来源:origin: azkaban/azkaban
final ConditionChecker checker1 =
new BasicTimeChecker("timeChecker1", now.getMillis(), now.getZone(),
true, true, Utils.parsePeriodString("1h"), null);
final Map<String, ConditionChecker> checkers1 =
new HashMap<>();
代码示例来源:origin: azkaban/azkaban
/**
* This test manipulates global states (time) in org.joda.time.DateTimeUtils . Thus this test can
* run in parallel with tests that do the same.
*/
@Test
public void periodTimerTest() {
// get a new timechecker, start from now, repeat every minute. should
// evaluate to false now, and true a minute later.
final long baseTimeInMilliSeconds = 1000;
final ReadablePeriod period = Utils.parsePeriodString("10s");
DateTimeUtils.setCurrentMillisFixed(baseTimeInMilliSeconds);
final BasicTimeChecker timeChecker =
new BasicTimeChecker("BasicTimeChecket_1", baseTimeInMilliSeconds,
DateTimeZone.UTC, true, true, period, null);
final Condition cond = getCondition(timeChecker);
assertFalse(cond.isMet());
DateTimeUtils.setCurrentMillisFixed(baseTimeInMilliSeconds + 11 * 1000);
assertTrue(cond.isMet());
cond.resetCheckers();
assertFalse(cond.isMet());
DateTimeUtils.setCurrentMillisFixed(baseTimeInMilliSeconds + 22 * 1000);
assertTrue(cond.isMet());
DateTimeUtils.setCurrentMillisSystem();
}
代码示例来源:origin: com.linkedin.azkaban/azkaban
public static BasicTimeChecker createFromJson(HashMap<String, Object> obj) throws Exception {
Map<String, Object> jsonObj = (HashMap<String, Object>) obj;
if(!jsonObj.get("type").equals(type)) {
throw new Exception("Cannot create checker of " + type + " from " + jsonObj.get("type"));
}
Long firstCheckTime = Long.valueOf((String) jsonObj.get("firstCheckTime"));
String timezoneId = (String) jsonObj.get("timezone");
long nextCheckTime = Long.valueOf((String) jsonObj.get("nextCheckTime"));
DateTimeZone timezone = DateTimeZone.forID(timezoneId);
boolean isRecurring = Boolean.valueOf((String)jsonObj.get("isRecurring"));
boolean skipPastChecks = Boolean.valueOf((String)jsonObj.get("skipPastChecks"));
ReadablePeriod period = Utils.parsePeriodString((String)jsonObj.get("period"));
String id = (String) jsonObj.get("id");
BasicTimeChecker checker = new BasicTimeChecker(id, firstCheckTime, timezone, nextCheckTime, isRecurring, skipPastChecks, period);
if(skipPastChecks) {
checker.updateNextCheckTime();
}
return checker;
}
代码示例来源:origin: com.linkedin.azkaban/azkaban-common
public static BasicTimeChecker createFromJson(final HashMap<String, Object> obj)
throws Exception {
final Map<String, Object> jsonObj = (HashMap<String, Object>) obj;
if (!jsonObj.get("type").equals(type)) {
throw new Exception("Cannot create checker of " + type + " from "
+ jsonObj.get("type"));
}
final Long firstCheckTime = Long.valueOf((String) jsonObj.get("firstCheckTime"));
final String timezoneId = (String) jsonObj.get("timezone");
final long nextCheckTime = Long.valueOf((String) jsonObj.get("nextCheckTime"));
final DateTimeZone timezone = DateTimeZone.forID(timezoneId);
final boolean isRecurring = Boolean.valueOf((String) jsonObj.get("isRecurring"));
final boolean skipPastChecks =
Boolean.valueOf((String) jsonObj.get("skipPastChecks"));
final ReadablePeriod period =
Utils.parsePeriodString((String) jsonObj.get("period"));
final String id = (String) jsonObj.get("id");
final String cronExpression = (String) jsonObj.get("cronExpression");
final BasicTimeChecker checker =
new BasicTimeChecker(id, firstCheckTime, timezone, nextCheckTime,
isRecurring, skipPastChecks, period, cronExpression);
if (skipPastChecks) {
checker.updateNextCheckTime();
}
return checker;
}
代码示例来源:origin: com.linkedin.azkaban/azkaban
if(type.equals(SlaOption.TYPE_FLOW_FINISH)) {
if(checkTime < flow.getStartTime()) {
ReadablePeriod duration = Utils.parsePeriodString((String) slaOption.getInfo().get(SlaOption.INFO_DURATION));
DateTime startTime = new DateTime(flow.getStartTime());
DateTime nextCheckTime = startTime.plus(duration);
} else if(type.equals(SlaOption.TYPE_FLOW_SUCCEED)) {
if(checkTime < flow.getStartTime()) {
ReadablePeriod duration = Utils.parsePeriodString((String) slaOption.getInfo().get(SlaOption.INFO_DURATION));
DateTime startTime = new DateTime(flow.getStartTime());
DateTime nextCheckTime = startTime.plus(duration);
ReadablePeriod duration = Utils.parsePeriodString((String) slaOption.getInfo().get(SlaOption.INFO_DURATION));
DateTime startTime = new DateTime(node.getStartTime());
DateTime nextCheckTime = startTime.plus(duration);
ReadablePeriod duration = Utils.parsePeriodString((String) slaOption.getInfo().get(SlaOption.INFO_DURATION));
DateTime startTime = new DateTime(node.getStartTime());
DateTime nextCheckTime = startTime.plus(duration);
代码示例来源:origin: com.linkedin.azkaban/azkaban
if(type.equals(SlaOption.TYPE_FLOW_FINISH)) {
if(checkTime < flow.getStartTime()) {
ReadablePeriod duration = Utils.parsePeriodString((String) slaOption.getInfo().get(SlaOption.INFO_DURATION));
DateTime startTime = new DateTime(flow.getStartTime());
DateTime nextCheckTime = startTime.plus(duration);
ReadablePeriod duration = Utils.parsePeriodString((String) slaOption.getInfo().get(SlaOption.INFO_DURATION));
DateTime startTime = new DateTime(flow.getStartTime());
DateTime nextCheckTime = startTime.plus(duration);
ReadablePeriod duration = Utils.parsePeriodString((String) slaOption.getInfo().get(SlaOption.INFO_DURATION));
DateTime startTime = new DateTime(node.getStartTime());
DateTime nextCheckTime = startTime.plus(duration);
ReadablePeriod duration = Utils.parsePeriodString((String) slaOption.getInfo().get(SlaOption.INFO_DURATION));
DateTime startTime = new DateTime(node.getStartTime());
DateTime nextCheckTime = startTime.plus(duration);
代码示例来源:origin: com.linkedin.azkaban/azkaban-common
if (this.checkTime < flow.getStartTime()) {
final ReadablePeriod duration =
Utils.parsePeriodString((String) this.slaOption.getInfo().get(
SlaOption.INFO_DURATION));
final DateTime startTime = new DateTime(flow.getStartTime());
if (this.checkTime < flow.getStartTime()) {
final ReadablePeriod duration =
Utils.parsePeriodString((String) this.slaOption.getInfo().get(
SlaOption.INFO_DURATION));
final DateTime startTime = new DateTime(flow.getStartTime());
Utils.parsePeriodString((String) this.slaOption.getInfo().get(
SlaOption.INFO_DURATION));
final DateTime startTime = new DateTime(node.getStartTime());
Utils.parsePeriodString((String) this.slaOption.getInfo().get(
SlaOption.INFO_DURATION));
final DateTime startTime = new DateTime(node.getStartTime());
代码示例来源:origin: com.linkedin.azkaban/azkaban-common
if (this.checkTime < flow.getStartTime()) {
final ReadablePeriod duration =
Utils.parsePeriodString((String) this.slaOption.getInfo().get(
SlaOption.INFO_DURATION));
final DateTime startTime = new DateTime(flow.getStartTime());
if (this.checkTime < flow.getStartTime()) {
final ReadablePeriod duration =
Utils.parsePeriodString((String) this.slaOption.getInfo().get(
SlaOption.INFO_DURATION));
final DateTime startTime = new DateTime(flow.getStartTime());
Utils.parsePeriodString((String) this.slaOption.getInfo().get(
SlaOption.INFO_DURATION));
final DateTime startTime = new DateTime(node.getStartTime());
Utils.parsePeriodString((String) this.slaOption.getInfo().get(
SlaOption.INFO_DURATION));
final DateTime startTime = new DateTime(node.getStartTime());
代码示例来源:origin: com.linkedin.azkaban/azkaban
ReadablePeriod period = Utils.parsePeriodString(schedProps.getString("period"));
内容来源于网络,如有侵权,请联系作者删除!