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