open-nomad/e2e/isolation/input/java.nomad

39 lines
726 B
Plaintext
Raw Normal View History

2021-01-27 14:44:07 +00:00
job "java_pid" {
datacenters = ["dc1"]
2021-01-27 20:49:47 +00:00
type = "batch"
2021-01-27 14:44:07 +00:00
group "java" {
task "build" {
lifecycle {
2021-01-27 20:49:47 +00:00
hook = "prestart"
2021-01-27 14:44:07 +00:00
sidecar = false
}
driver = "exec"
config {
command = "javac"
2021-01-27 20:49:47 +00:00
args = ["-d", "${NOMAD_ALLOC_DIR}", "local/Pid.java"]
2021-01-27 14:44:07 +00:00
}
template {
destination = "local/Pid.java"
2021-01-27 20:49:47 +00:00
data = <<EOH
2021-01-27 14:44:07 +00:00
public class Pid {
public static void main(String... s) throws Exception {
System.out.println("my pid is " + ProcessHandle.current().pid());
}
}
EOH
}
}
task "pid" {
driver = "java"
config {
class_path = "${NOMAD_ALLOC_DIR}"
2021-01-27 20:49:47 +00:00
class = "Pid"
2021-01-27 14:44:07 +00:00
}
}
}
}