github.com/hernad/nomad@v1.6.112/e2e/isolation/input/java_host.hcl (about) 1 # Copyright (c) HashiCorp, Inc. 2 # SPDX-License-Identifier: MPL-2.0 3 4 job "java_host" { 5 type = "batch" 6 7 constraint { 8 attribute = "${attr.kernel.name}" 9 value = "linux" 10 } 11 12 group "group" { 13 14 15 reschedule { 16 attempts = 0 17 unlimited = false 18 } 19 20 restart { 21 attempts = 0 22 mode = "fail" 23 } 24 25 26 task "build" { 27 lifecycle { 28 hook = "prestart" 29 sidecar = false 30 } 31 32 driver = "exec" 33 config { 34 command = "javac" 35 args = ["-d", "${NOMAD_ALLOC_DIR}", "local/Pid.java"] 36 } 37 38 template { 39 destination = "local/Pid.java" 40 data = <<EOH 41 public class Pid { 42 public static void main(String... s) throws Exception { 43 System.out.println("my pid is " + ProcessHandle.current().pid()); 44 } 45 } 46 EOH 47 } 48 49 resources { 50 cpu = 50 51 memory = 64 52 } 53 } 54 55 task "java" { 56 driver = "java" 57 config { 58 class_path = "${NOMAD_ALLOC_DIR}" 59 class = "Pid" 60 pid_mode = "host" 61 ipc_mode = "host" 62 } 63 64 resources { 65 cpu = 50 66 memory = 64 67 } 68 } 69 } 70 }