forked from GuyBarros/nomad_jobs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
windows_batchjob.nomad
56 lines (42 loc) · 1.11 KB
/
windows_batchjob.nomad
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
job "batchjob" {
datacenters = ["dc1"]
type = "batch"
constraint {
attribute = "${attr.kernel.name}"
value = "windows"
}
// to dispatch this job use nomad job dispatch -meta TTL=60 batchjob payload.json
parameterized {
payload = "required"
meta_required = ["TTL"] #ttl is the amount of time this batch job will run for before it gets executed
}
group "clients1" {
count = 1
task "callexe" {
template {
data = <<EOH
param(
$TTL
)
start local/repo/dotnet-batch-service.exe
ping 127.0.0.1 -n $TTL
taskkill /im dotnet-batch-service.exe /f
EOH
destination = "local/runbatch.ps1"
}
driver = "raw_exec"
resources {
cpu = 1000
memory = 256
}
artifact {
source = "git::https://github.com/GuyBarros/dotnet-batch-service"
destination = "local/repo"
}
config {
command = "powershell.exe"
args = ["local/runbatch.ps1 ${NOMAD_META_TTL}"]
}
}
}
}