forked from johnny-chivers/emrZeroToHero
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemr-sfn.json
164 lines (164 loc) · 7.09 KB
/
emr-sfn.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
{
"Comment": "State machine to invoke multiple EMR jobs",
"StartAt": "Parallel",
"States": {
"Parallel": {
"Type": "Parallel",
"Next": "Terminate Cluster?",
"Branches": [
{
"StartAt": "Add Spark Steps",
"States": {
"Add Spark Steps": {
"Type": "Map",
"Iterator": {
"StartAt": "Add Spark Step To EMR Cluster",
"States": {
"Add Spark Step To EMR Cluster": {
"Type": "Task",
"Resource": "arn:aws:states:::elasticmapreduce:addStep.sync",
"Parameters": {
"ClusterId.$": "$.clusterId",
"Step": {
"Name": "SparkJob",
"HadoopJarStep": {
"Jar": "command-runner.jar",
"Args.$": "$.sparkArgs"
}
}
},
"ResultPath": "$.sparkResult",
"End": true
}
}
},
"ItemsPath": "$.sparkArgs",
"Parameters": {
"sparkArgs.$": "$$.Map.Item.Value",
"clusterId.$": "$.clusterId"
},
"ResultPath": null,
"End": true
}
}
},
{
"StartAt": "Wait - Hive",
"States": {
"Wait - Hive": {
"Type": "Wait",
"Seconds": 60,
"Next": "Add Hive Steps"
},
"Add Hive Steps": {
"Type": "Map",
"Iterator": {
"StartAt": "Add Hive Step To EMR Cluster",
"States": {
"Add Hive Step To EMR Cluster": {
"Type": "Task",
"Resource": "arn:aws:states:::elasticmapreduce:addStep.sync",
"Parameters": {
"ClusterId.$": "$.clusterId",
"Step": {
"Name": "HiveJob",
"HadoopJarStep": {
"Jar": "command-runner.jar",
"Args.$": "$.hiveArgs"
}
}
},
"ResultPath": "$.hiveResult",
"End": true
}
}
},
"ItemsPath": "$.hiveArgs",
"Parameters": {
"hiveArgs.$": "$$.Map.Item.Value",
"clusterId.$": "$.clusterId"
},
"End": true,
"ResultPath": null
}
}
},
{
"StartAt": "Wait - Pig",
"States": {
"Wait - Pig": {
"Type": "Wait",
"Seconds": 120,
"Next": "Add Pig Steps"
},
"Add Pig Steps": {
"Type": "Map",
"Iterator": {
"StartAt": "Add Pig Step To EMR Cluster",
"States": {
"Add Pig Step To EMR Cluster": {
"Type": "Task",
"Resource": "arn:aws:states:::elasticmapreduce:addStep.sync",
"Parameters": {
"ClusterId.$": "$.clusterId",
"Step": {
"Name": "PigJob",
"HadoopJarStep": {
"Jar": "command-runner.jar",
"Args.$": "$.pigArgs"
}
}
},
"ResultPath": "$.pigResult",
"End": true
}
}
},
"End": true,
"ItemsPath": "$.pigArgs",
"Parameters": {
"pigArgs.$": "$$.Map.Item.Value",
"clusterId.$": "$.clusterId"
},
"ResultPath": null
}
}
}
],
"ResultPath": null
},
"Terminate Cluster?": {
"Type": "Choice",
"Choices": [
{
"Variable": "$.deleteCluster",
"BooleanEquals": true,
"Next": "Disable Termination Protection"
}
],
"Default": "Wrap Up"
},
"Disable Termination Protection": {
"Type": "Task",
"Resource": "arn:aws:states:::elasticmapreduce:setClusterTerminationProtection",
"Parameters": {
"ClusterId.$": "$.clusterId",
"TerminationProtected": false
},
"ResultPath": null,
"Next": "Terminate EMR cluster"
},
"Terminate EMR cluster": {
"Type": "Task",
"Resource": "arn:aws:states:::elasticmapreduce:terminateCluster.sync",
"Parameters": {
"ClusterId.$": "$.clusterId"
},
"Next": "Wrap Up"
},
"Wrap Up": {
"Type": "Pass",
"End": true
}
}
}