Skip to content

Commit ec0e789

Browse files
author
jamiesjc
committed
Fix cloneWorkflow and cloneJob issue when generating conditional workflows.
1 parent 7f794be commit ec0e789

File tree

9 files changed

+91
-2
lines changed

9 files changed

+91
-2
lines changed

CONTRIBUTORS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ The following were contributed by Jamie Sun. Thanks, Jamie!
157157
* `Fix base properties scope for subflows when generating YAML files`
158158
* `Fix variable substitution issue when generating YAML files`
159159
* `Fix variable substitution issue for dependency list`
160+
* `Fix cloneWorkflow and cloneJob issue when generating conditional workflows`
160161

161162
The following were contributed by Rakesh Malladi. Thanks, Rakesh!
162-
* `Add ability for Hadoop DSL to understand the WormholePushJob job type`
163+
* `Add ability for Hadoop DSL to understand the WormholePushJob job type`

VERSIONS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ 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.31
21+
* Fix cloneWorkflow and cloneJob issue when generating conditional workflows
22+
2023
0.14.30
2124
* Adding WormholePushJob job type support
2225

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.30
2+
version=0.14.31
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
azkaban-flow-version: 2.0
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
nodes:
2+
- name: workflow1
3+
type: noop
4+
dependsOn:
5+
- shellEcho
6+
- embeddedFlow
7+
- name: shellEcho
8+
type: command
9+
dependsOn:
10+
- shellPwd
11+
condition: one_success
12+
config:
13+
command: echo "This is an echoed text."
14+
- name: shellPwd
15+
type: command
16+
config:
17+
command: pwd
18+
- name: embeddedFlow
19+
type: flow
20+
dependsOn:
21+
- shellPwd
22+
condition: one_failed
23+
nodes:
24+
- name: embeddedFlow
25+
type: noop
26+
dependsOn:
27+
- job1
28+
- name: job1
29+
type: command
30+
config:
31+
command: pwd
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
:hadoop-plugin-test:test_cloneJobWithCondition
2+
Running test for the file positive/cloneJobWithCondition.gradle
3+
Hadoop DSL static checker PASSED
4+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
buildscript {
2+
repositories {
3+
jcenter()
4+
}
5+
dependencies {
6+
classpath files("${project.pluginTestDir}/hadoop-plugin-${project.version}.jar", "${project.pluginTestDir}/hadoop-plugin-${project.version}-SNAPSHOT.jar")
7+
// Must manually specify snakeyaml for testing, not required for users
8+
classpath 'org.yaml:snakeyaml:1.18'
9+
}
10+
}
11+
12+
apply plugin: com.linkedin.gradle.hadoop.HadoopPlugin
13+
14+
// Test clone a workflow (which invokes clone jobs) when generating conditional workflows
15+
16+
workflow('basicFlow') {
17+
commandJob('shellPwd') {
18+
uses 'pwd'
19+
}
20+
21+
commandJob('shellEcho') {
22+
uses 'echo "This is an echoed text."'
23+
depends 'shellPwd'
24+
conditions 'one_success'
25+
}
26+
27+
workflow('embeddedFlow') {
28+
commandJob('job1') {
29+
uses 'pwd'
30+
}
31+
32+
flowDepends('shellPwd')
33+
conditions 'one_failed'
34+
targets 'job1'
35+
}
36+
37+
targets 'shellEcho', 'embeddedFlow'
38+
}
39+
40+
hadoop {
41+
buildPath "jobs/cloneJobWithCondition"
42+
cleanPath false
43+
44+
generateYamlOutput true
45+
46+
addWorkflow('basicFlow', 'workflow1') {}
47+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ class Workflow extends BaseNamedScopeContainer {
273273
*/
274274
protected Workflow clone(Workflow workflow) {
275275
workflow.isGrouping = isGrouping;
276+
workflow.condition = condition;
276277
workflow.launchDependencies.addAll(launchDependencies);
277278
workflow.parentDependencies.addAll(parentDependencies);
278279
return ((Workflow)super.clone(workflow));

hadoop-plugin/src/main/groovy/com/linkedin/gradle/hadoopdsl/job/Job.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ class Job {
201201
*/
202202
Job clone(Job cloneJob) {
203203
cloneJob.basePropertySetName = basePropertySetName;
204+
cloneJob.condition = condition;
204205
cloneJob.dependencyNames.addAll(dependencyNames);
205206
cloneJob.jobProperties.putAll(jobProperties);
206207
cloneJob.reading.putAll(reading);

0 commit comments

Comments
 (0)