Skip to content

Commit 8439bba

Browse files
author
Charlie Summers
authored
Remove maxWaitMins requirement if no dependencies defined in Trigger (linkedin#219)
1 parent cb83083 commit 8439bba

File tree

6 files changed

+20
-9
lines changed

6 files changed

+20
-9
lines changed

CONTRIBUTORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ The following were contributed by Charlie Summers. Thanks, Charlie!
132132
* `Add ability for Hadoop DSL to understand the TableauJob job type`
133133
* `Adding additional condition for TableauJob creation`
134134
* `Allow generateYamlOutput to be defined multiple times`
135+
* `Remove maxWaitMins requirement if no dependencies defined in Trigger`
135136

136137
The following were contributed by Nicholas Cowan. Thanks, Nick!
137138
* `Add ability for Hadoop DSL to understand the HdfsWait job type`

VERSIONS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ the License.
1717
Note that the LinkedIn build system occasionally requires that we skip a
1818
version bump, so you will see a few skipped version numbers in the list below.
1919

20+
0.14.14
21+
22+
* Remove maxWaitMins requirement if no dependencies defined in Trigger
23+
2024
0.14.13
2125

2226
* Allow generateYamlOutput to be defined multiple times

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
org.gradle.daemon=true
2-
version=0.14.13
2+
version=0.14.14

hadoop-plugin-test/expectedOutput/negative/triggerCheck.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ TriggerChecker ERROR: DaliDependency dali-data-dep in Trigger trigger1 in Workfl
1010
TriggerChecker ERROR: DaliDependency dali-data-dep in Trigger trigger1 in Workflow triggerFail1 must have a window greater than 0.
1111
TriggerChecker ERROR: DaliDependency dali-data-dep in Trigger trigger1 in Workflow triggerFail1 must have a nonnegative delay.
1212
TriggerChecker ERROR: 'unit' value in DaliDependency dali-data-dep in Trigger trigger1 in Workflow triggerFail1 can only be set to 'daily' or 'hourly'.
13-
TriggerChecker ERROR: Trigger trigger2 in Workflow triggerFail1 must define 'maxWaitMins' and it must be greater than 0.
13+
TriggerChecker WARN: Trigger trigger2 in Workflow triggerFail1 defines 'maxWaitMins' when there are no dependencies. Azkaban will automatically launch the flow when the schedule is met, so this isn't necessary.
1414
TriggerChecker ERROR: Trigger trigger2 in Workflow triggerFail1 contains more than one schedule.
1515
TriggerChecker ERROR: Schedule in Trigger trigger2 in Workflow triggerFail1 must define 'value'.
1616
TriggerChecker ERROR: Schedule in Trigger trigger2 in Workflow triggerFail1 must define 'value' as a valid cron expression.

hadoop-plugin-test/src/main/gradle/negative/triggerCheck.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ hadoop {
2222

2323
workflow('triggerFail1') {
2424
trigger('trigger1') {
25-
// no maxWaitMins throws an ERROR
25+
// no maxWaitMins when there is a dependency throws an ERROR
2626
// no schedule throws an ERROR
2727
daliDependency('dali-data-dep') {
2828
// no dali dependency view throws an ERROR
@@ -33,7 +33,8 @@ hadoop {
3333
}
3434

3535
trigger('trigger2') { // two defined triggers throws an ERROR
36-
maxWaitMins 0 // maxWaitMins less than 1 throws an ERROR
36+
// maxWaitMins defined with no dependencies throws a WARN
37+
maxWaitMins 1
3738
schedule {
3839
// no schedule value throws an ERROR
3940
}

hadoop-plugin/src/main/groovy/com/linkedin/gradle/hadoopdsl/checker/TriggerChecker.groovy

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ import org.quartz.CronExpression;
1414
* <ul>
1515
* <li>Trigger specific
1616
* <li>ERROR if more than 1 trigger is defined in a workflow.</li>
17-
* <li>ERROR if a trigger maxWaitMins doesn't exist or is less than 1.</li>
17+
* <li>ERROR if there are dependencies and a trigger maxWaitMins doesn't exist or is less than 1.</li>
1818
* <li>WARN if a trigger maxWaitMins is greater than 10 days (14400) - will be set to 10 days
1919
* by Azkaban.</li>
20+
* <li>WARN if a trigger maxWaitMins is set and there are no dependencies</li>
2021
* <li>ERROR if a trigger schedule doesn't exist.</li>
2122
* <li>ERROR if more than one trigger schedule is defined for a trigger.</li>
2223
* <li>ERROR if a trigger schedule doesn't have a value.</li>
@@ -25,7 +26,7 @@ import org.quartz.CronExpression;
2526
* <li>ERROR if a trigger dependency name is not unique.</li>
2627
* <li>ERROR if a trigger dependency config (type + params) is not unique.</li>
2728
* <li>
28-
* <li>DaliDependency specific
29+
* <li>DaliDependency specific</li>
2930
* <li>ERROR if a trigger dali dependency doesn't have a view.</li>
3031
* <li>ERROR if a trigger dali dependency doesn't have a window.</li>
3132
* <li>ERROR if a trigger dali dependency doesn't have a delay.</li>
@@ -106,15 +107,19 @@ class TriggerChecker extends BaseStaticChecker {
106107
boolean checkWaitMins() {
107108
boolean checkWaitMinsError = false;
108109

109-
// ERROR if maxWaitMins not defined or >1
110-
if (trigger.maxWaitMins < MIN_FLOW_TRIGGER_WAIT_TIME) {
110+
// ERROR if there are dependencies and maxWaitMins doesn't exist or <1
111+
if (trigger.triggerDependencies.size() != 0 && trigger.maxWaitMins < MIN_FLOW_TRIGGER_WAIT_TIME) {
111112
project.logger.lifecycle("TriggerChecker ERROR: Trigger ${trigger.name} in Workflow ${workflow.name} must define 'maxWaitMins' and it must be greater than 0.");
112113
checkWaitMinsError = true;
113114
}
114115
// WARN if maxWaitMins >10 days (14400 mins)
115-
else if (trigger.maxWaitMins > MAX_FLOW_TRIGGER_WAIT_TIME) {
116+
if (trigger.maxWaitMins > MAX_FLOW_TRIGGER_WAIT_TIME) {
116117
project.logger.lifecycle("TriggerChecker WARN: Trigger ${trigger.name} in Workflow ${workflow.name} defines 'maxWaitMins' to be greater than 10 days. Azkaban will automatically reduce to 10 days.");
117118
}
119+
// WARN if maxWaitMins is set when there are no dependencies
120+
if (trigger.triggerDependencies.size() == 0 && trigger.maxWaitMins != 0) {
121+
project.logger.lifecycle("TriggerChecker WARN: Trigger ${trigger.name} in Workflow ${workflow.name} defines 'maxWaitMins' when there are no dependencies. Azkaban will automatically launch the flow when the schedule is met, so this isn't necessary.");
122+
}
118123

119124
return checkWaitMinsError;
120125
}

0 commit comments

Comments
 (0)