8ee9835923
This PR adds pid_mode and ipc_mode options to the exec and java task driver config options. By default these will defer to the default_pid_mode and default_ipc_mode agent plugin options created in #9969. Setting these values to "host" mode disables isolation for the task. Doing so is not recommended, but may be necessary to support legacy job configurations. Closes #9970
41 lines
782 B
HCL
41 lines
782 B
HCL
job "java_pid" {
|
|
datacenters = ["dc1"]
|
|
type = "batch"
|
|
|
|
group "java" {
|
|
|
|
task "build" {
|
|
lifecycle {
|
|
hook = "prestart"
|
|
sidecar = false
|
|
}
|
|
|
|
driver = "exec"
|
|
config {
|
|
command = "javac"
|
|
args = ["-d", "${NOMAD_ALLOC_DIR}", "local/Pid.java"]
|
|
}
|
|
|
|
template {
|
|
destination = "local/Pid.java"
|
|
data = <<EOH
|
|
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}"
|
|
class = "Pid"
|
|
pid_mode = "host"
|
|
ipc_mode = "host"
|
|
}
|
|
}
|
|
}
|
|
} |