e0b56c1843f3f9a3fa3aecad21c40b9a2c6bd4d5
[csit.git] / fdio.infra.terraform / terraform-nomad-pyspark-etl / conf / nomad / etl.hcl.tftpl
1 job "${job_name}" {
2   # The "datacenters" parameter specifies the list of datacenters which should
3   # be considered when placing this task. This must be provided.
4   datacenters = "${datacenters}"
5
6   # The "type" parameter controls the type of job, which impacts the scheduler's
7   # decision on placement. For a full list of job types and their differences,
8   # please see the online documentation.
9   #
10   #     https://www.nomadproject.io/docs/jobspec/schedulers
11   #
12   type        = "${type}"
13
14   # The periodic stanza allows a job to run at fixed times, dates, or intervals.
15   # The easiest way to think about the periodic scheduler is "Nomad cron" or
16   # "distributed cron".
17   #
18   #     https://www.nomadproject.io/docs/job-specification/periodic
19   #
20   periodic {
21     cron             = "${cron}"
22     prohibit_overlap = "${prohibit_overlap}"
23     time_zone        = "${time_zone}"
24   }
25
26   # The "group" stanza defines a series of tasks that should be co-located on
27   # the same Nomad client. Any task within a group will be placed on the same
28   # client.
29   #
30   #     https://www.nomadproject.io/docs/job-specification/group
31   #
32   group "${job_name}-master" {
33     # The restart stanza configures a tasks's behavior on task failure. Restarts
34     # happen on the client that is running the task.
35     #
36     # https://www.nomadproject.io/docs/job-specification/restart
37     #
38     restart {
39       mode = "fail"
40     }
41
42     # The constraint allows restricting the set of eligible nodes. Constraints
43     # may filter on attributes or client metadata.
44     #
45     # For more information and examples on the "volume" stanza, please see
46     # the online documentation at:
47     #
48     #     https://www.nomadproject.io/docs/job-specification/constraint
49     #
50     constraint {
51       attribute       = "$${attr.cpu.arch}"
52       operator        = "!="
53       value           = "arm64"
54     }
55
56     constraint {
57       attribute      = "$${node.class}"
58       value          = "builder"
59     }
60
61     # The "task" stanza creates an individual unit of work, such as a Docker
62     # container, web application, or batch processing.
63     #
64     #     https://www.nomadproject.io/docs/job-specification/task.html
65     #
66     task "${job_name}-trending" {
67       # The artifact stanza instructs Nomad to fetch and unpack a remote
68       # resource, such as a file, tarball, or binary.
69       #
70       #     https://www.nomadproject.io/docs/job-specification/artifact
71       #
72       artifact {
73         source      = "git::https://github.com/FDio/csit"
74         destination = "local/csit"
75       }
76
77       # The "driver" parameter specifies the task driver that should be used to
78       # run the task.
79       driver = "docker"
80
81       # The "config" stanza specifies the driver configuration, which is passed
82       # directly to the driver to start the task. The details of configurations
83       # are specific to each driver, so please see specific driver
84       # documentation for more information.
85       config {
86         image   = "${image}"
87         command = "gluesparksubmit"
88         args = [
89           "--driver-memory", "20g",
90           "--executor-memory", "20g",
91           "trending.py"
92         ]
93         work_dir = "/local/csit/csit.infra.etl"
94       }
95
96       # The env stanza configures a list of environment variables to populate
97       # the task's environment before starting.
98       env {
99         AWS_ACCESS_KEY_ID         = "${aws_access_key_id}"
100         AWS_SECRET_ACCESS_KEY     = "${aws_secret_access_key}"
101         AWS_DEFAULT_REGION        = "${aws_default_region}"
102         OUT_AWS_ACCESS_KEY_ID     = "${out_aws_access_key_id}"
103         OUT_AWS_SECRET_ACCESS_KEY = "${out_aws_secret_access_key}"
104         OUT_AWS_DEFAULT_REGION    = "${out_aws_default_region}"
105         ${ envs }
106       }
107
108       # The "resources" stanza describes the requirements a task needs to
109       # execute. Resource requirements include memory, network, cpu, and more.
110       # This ensures the task will execute on a machine that contains enough
111       # resource capacity.
112       #
113       #     https://www.nomadproject.io/docs/job-specification/resources
114       #
115       resources {
116         cpu    = ${cpu}
117         memory = ${memory}
118       }
119     }
120     task "${job_name}-stats" {
121       # The artifact stanza instructs Nomad to fetch and unpack a remote
122       # resource, such as a file, tarball, or binary.
123       #
124       #     https://www.nomadproject.io/docs/job-specification/artifact
125       #
126       artifact {
127         source      = "git::https://github.com/FDio/csit"
128         destination = "local/csit"
129       }
130
131       # The "driver" parameter specifies the task driver that should be used to
132       # run the task.
133       driver = "docker"
134
135       # The "config" stanza specifies the driver configuration, which is passed
136       # directly to the driver to start the task. The details of configurations
137       # are specific to each driver, so please see specific driver
138       # documentation for more information.
139       config {
140         image   = "${image}"
141         command = "gluesparksubmit"
142         args = [
143           "--driver-memory", "10g",
144           "--executor-memory", "10g",
145           "stats.py"
146         ]
147         work_dir = "/local/csit/csit.infra.etl"
148       }
149
150       # The env stanza configures a list of environment variables to populate
151       # the task's environment before starting.
152       env {
153         AWS_ACCESS_KEY_ID         = "${aws_access_key_id}"
154         AWS_SECRET_ACCESS_KEY     = "${aws_secret_access_key}"
155         AWS_DEFAULT_REGION        = "${aws_default_region}"
156         OUT_AWS_ACCESS_KEY_ID     = "${out_aws_access_key_id}"
157         OUT_AWS_SECRET_ACCESS_KEY = "${out_aws_secret_access_key}"
158         OUT_AWS_DEFAULT_REGION    = "${out_aws_default_region}"
159         ${ envs }
160       }
161
162       # The "resources" stanza describes the requirements a task needs to
163       # execute. Resource requirements include memory, network, cpu, and more.
164       # This ensures the task will execute on a machine that contains enough
165       # resource capacity.
166       #
167       #     https://www.nomadproject.io/docs/job-specification/resources
168       #
169       resources {
170         cpu    = ${cpu}
171         memory = ${memory}
172       }
173     }
174   }
175 #  group "${job_name}-rls2202" {
176 #    # The restart stanza configures a tasks's behavior on task failure. Restarts
177 #    # happen on the client that is running the task.
178 #    #
179 #    # https://www.nomadproject.io/docs/job-specification/restart
180 #    #
181 #    restart {
182 #      mode = "fail"
183 #    }
184 #
185 #    # The constraint allows restricting the set of eligible nodes. Constraints
186 #    # may filter on attributes or client metadata.
187 #    #
188 #    # For more information and examples on the "volume" stanza, please see
189 #    # the online documentation at:
190 #    #
191 #    #     https://www.nomadproject.io/docs/job-specification/constraint
192 #    #
193 #    constraint {
194 #      attribute       = "$${attr.cpu.arch}"
195 #      operator        = "!="
196 #      value           = "arm64"
197 #    }
198 #
199 #    constraint {
200 #      attribute      = "$${node.class}"
201 #      value          = "builder"
202 #    }
203 #
204 #    # The "task" stanza creates an individual unit of work, such as a Docker
205 #    # container, web application, or batch processing.
206 #    #
207 #    #     https://www.nomadproject.io/docs/job-specification/task.html
208 #    #
209 #    task "${job_name}-coverage" {
210 #      # The artifact stanza instructs Nomad to fetch and unpack a remote
211 #      # resource, such as a file, tarball, or binary.
212 #      #
213 #      #     https://www.nomadproject.io/docs/job-specification/artifact
214 #      #
215 #      artifact {
216 #        source      = "git::https://github.com/FDio/csit"
217 #        destination = "local/csit"
218 #      }
219 #
220 #      # The "driver" parameter specifies the task driver that should be used to
221 #      # run the task.
222 #      driver = "docker"
223 #
224 #      # The "config" stanza specifies the driver configuration, which is passed
225 #      # directly to the driver to start the task. The details of configurations
226 #      # are specific to each driver, so please see specific driver
227 #      # documentation for more information.
228 #      config {
229 #        image   = "${image}"
230 #        command = "gluesparksubmit"
231 #        args = [
232 #          "--driver-memory", "20g",
233 #          "--executor-memory", "20g",
234 #          "coverage_rls2202.py"
235 #        ]
236 #        work_dir = "/local/csit/csit.infra.etl"
237 #      }
238 #
239 #      # The env stanza configures a list of environment variables to populate
240 #      # the task's environment before starting.
241 #      env {
242 #        AWS_ACCESS_KEY_ID         = "${aws_access_key_id}"
243 #        AWS_SECRET_ACCESS_KEY     = "${aws_secret_access_key}"
244 #        AWS_DEFAULT_REGION        = "${aws_default_region}"
245 #        OUT_AWS_ACCESS_KEY_ID     = "${out_aws_access_key_id}"
246 #        OUT_AWS_SECRET_ACCESS_KEY = "${out_aws_secret_access_key}"
247 #        OUT_AWS_DEFAULT_REGION    = "${out_aws_default_region}"
248 #        ${ envs }
249 #      }
250 #
251 #      # The "resources" stanza describes the requirements a task needs to
252 #      # execute. Resource requirements include memory, network, cpu, and more.
253 #      # This ensures the task will execute on a machine that contains enough
254 #      # resource capacity.
255 #      #
256 #      #     https://www.nomadproject.io/docs/job-specification/resources
257 #      #
258 #      resources {
259 #        cpu    = ${cpu}
260 #        memory = ${memory}
261 #      }
262 #    }
263 #    task "${job_name}-iterative" {
264 #      # The artifact stanza instructs Nomad to fetch and unpack a remote
265 #      # resource, such as a file, tarball, or binary.
266 #      #
267 #      #     https://www.nomadproject.io/docs/job-specification/artifact
268 #      #
269 #      artifact {
270 #        source      = "git::https://github.com/FDio/csit"
271 #        destination = "local/csit"
272 #      }
273 #
274 #      # The "driver" parameter specifies the task driver that should be used to
275 #      # run the task.
276 #      driver = "docker"
277 #
278 #      # The "config" stanza specifies the driver configuration, which is passed
279 #      # directly to the driver to start the task. The details of configurations
280 #      # are specific to each driver, so please see specific driver
281 #      # documentation for more information.
282 #      config {
283 #        image   = "${image}"
284 #        command = "gluesparksubmit"
285 #        args = [
286 #          "--driver-memory", "20g",
287 #          "--executor-memory", "20g",
288 #          "iterative_rls2202.py"
289 #        ]
290 #        work_dir = "/local/csit/csit.infra.etl"
291 #      }
292 #
293 #      # The env stanza configures a list of environment variables to populate
294 #      # the task's environment before starting.
295 #      env {
296 #        AWS_ACCESS_KEY_ID         = "${aws_access_key_id}"
297 #        AWS_SECRET_ACCESS_KEY     = "${aws_secret_access_key}"
298 #        AWS_DEFAULT_REGION        = "${aws_default_region}"
299 #        OUT_AWS_ACCESS_KEY_ID     = "${out_aws_access_key_id}"
300 #        OUT_AWS_SECRET_ACCESS_KEY = "${out_aws_secret_access_key}"
301 #        OUT_AWS_DEFAULT_REGION    = "${out_aws_default_region}"
302 #        ${ envs }
303 #      }
304 #
305 #      # The "resources" stanza describes the requirements a task needs to
306 #      # execute. Resource requirements include memory, network, cpu, and more.
307 #      # This ensures the task will execute on a machine that contains enough
308 #      # resource capacity.
309 #      #
310 #      #     https://www.nomadproject.io/docs/job-specification/resources
311 #      #
312 #      resources {
313 #        cpu    = ${cpu}
314 #        memory = ${memory}
315 #      }
316 #    }
317 #  }
318 }