github.com/kardianos/nomad@v0.1.3-0.20151022182107-b13df73ee850/website/source/docs/commands/run.html.md.erb (about) 1 --- 2 layout: "docs" 3 page_title: "Commands: run" 4 sidebar_current: "docs-commands-run" 5 description: > 6 The run command is used to run a new job. 7 --- 8 9 # Command: run 10 11 The `run` command is used to submit new jobs to Nomad or to update existing 12 jobs. Job files must conform to the [job specification](/docs/jobspec/index.html) 13 format. 14 15 ## Usage 16 17 ``` 18 nomad run [options] <file> 19 ``` 20 21 The run command requires a single argument, specifying the path to a file 22 containing a valid [job specification](/docs/jobspec/index.html). This file 23 will be read and the job will be submitted to Nomad for scheduling. 24 25 By default, on sucessful job submission the run command will enter an 26 interactive monitor and display log information detailing the scheduling 27 decisions and placement information for the provided job. The monitor will 28 exit after scheduling has finished or failed. 29 30 On successful job submission and scheduling, exit code 0 will be returned. If 31 there are job placement issues encountered (unsatisfiable constraints, resource 32 exhaustion, etc), then the exit code will be 2. Any other errors, including 33 client connection issues or internal errors, are indicated by exit code 1. 34 35 ## General Options 36 37 <%= general_options_usage %> 38 39 ## Run Options 40 41 * `-detach`: Return immediately instead of monitoring. A new evaluation ID 42 will be output, which can be used to call the monitor later using the 43 [eval-monitor](/docs/commands/eval-monitor.html) command. 44 45 ## Examples 46 47 Schedule the job contained in the file `job1.nomad`, monitoring placement: 48 49 ``` 50 $ nomad run job1.nomad 51 ==> Monitoring evaluation "52dee78a-a1f0-95c9-81a5-95b4cbe7f6f8" 52 Allocation "5e0b39f0-5e69-6fec-d17b-4b8b7d922cc8" created: node "3e84d3d2-8500-42a3-9d1b-7ad88913352b", group "group1" 53 Allocation "5e0b39f0-5e69-6fec-d17b-4b8b7d922cc8" status changed: "pending" -> "running" 54 Evaluation status changed: "pending" -> "complete" 55 ==> Evaluation "52dee78a-a1f0-95c9-81a5-95b4cbe7f6f8" finished with status "complete" 56 ``` 57 58 Schedule the job contained in `job1.nomad` and return immediately: 59 60 ``` 61 $ nomad run -detach job1.nomad 62 4947e728-fb4e-90c6-895a-42479940e0bc 63 ``` 64 65 Schedule a job which cannot get placement. This results in a scheduling failure 66 and the specifics of the placement are printed: 67 68 ``` 69 $ nomad run failing.nomad 70 ==> Monitoring evaluation "0d7447d9-43fd-4994-6812-500c93c08fce" 71 Scheduling error for group "group1" (failed to find a node for placement) 72 Allocation "a739288e-547a-cd26-1355-e92ca10f165c" status "failed" (1/1 nodes filtered) 73 * Constraint "$attr.kernel.name = linux" filtered 1 nodes 74 Evaluation status changed: "pending" -> "complete" 75 ==> Evaluation "0d7447d9-43fd-4994-6812-500c93c08fce" finished with status "complete" 76 ```