github.com/smintz/nomad@v0.8.3/website/source/docs/commands/job/dispatch.html.md.erb (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Commands: job dispatch"
     4  sidebar_current: "docs-commands-job-dispatch"
     5  description: >
     6    The dispatch command is used to create an instance of a parameterized job.
     7  ---
     8  
     9  # Command: job dispatch
    10  
    11  The `job dispatch` command is used to create new instances of a [parameterized
    12  job]. The parameterized job captures a job's configuration and runtime
    13  requirements in a generic way and `dispatch` is used to provide the input for
    14  the job to run against. A parameterized job is similar to a function definition,
    15  and dispatch is used to invoke the function.
    16  
    17  Each time a job is dispatched, a unique job ID is generated. This allows a
    18  caller to track the status of the job, much like a future or promise in some
    19  programming languages.
    20  
    21  ## Usage
    22  
    23  ```
    24  nomad job dispatch [options] <parameterized job> [input source]
    25  ```
    26  
    27  Dispatch creates an instance of a parameterized job. A data payload to the
    28  dispatched instance can be provided via stdin by using "-" for the input source
    29  or by specifying a path to a file. Metadata can be supplied by using the meta
    30  flag one or more times.
    31  
    32  The payload has a **size limit of 16KiB**.
    33  
    34  Upon successful creation, the dispatched job ID will be printed and the
    35  triggered evaluation will be monitored. This can be disabled by supplying the
    36  detach flag.
    37  
    38  On successful job submission and scheduling, exit code 0 will be returned. If
    39  there are job placement issues encountered (unsatisfiable constraints, resource
    40  exhaustion, etc), then the exit code will be 2. Any other errors, including
    41  client connection issues or internal errors, are indicated by exit code 1.
    42  
    43  ## General Options
    44  
    45  <%= partial "docs/commands/_general_options" %>
    46  
    47  ## Dispatch Options
    48  
    49  * `-meta`: Meta takes a key/value pair separated by "=". The metadata key will
    50    be merged into the job's metadata. The job may define a default value for the
    51    key which is overridden when dispatching. The flag can be provided more than
    52    once to inject multiple metadata key/value pairs. Arbitrary keys are not
    53    allowed. The parameterized job must allow the key to be merged.
    54  
    55  * `-detach`: Return immediately instead of monitoring. A new evaluation ID
    56    will be output, which can be used to examine the evaluation using the
    57    [eval status](/docs/commands/eval-status.html) command
    58  
    59  * `-verbose`: Show full information.
    60  
    61  ## Examples
    62  
    63  Dispatch against a parameterized job with the ID "video-encode" and
    64  passing in a configuration payload via stdin:
    65  
    66  ```
    67  $ cat << EOF | nomad job dispatch video-encode -
    68  {
    69    "s3-input": "https://s3-us-west-1.amazonaws.com/video-bucket/cb31dabb1",
    70    "s3-output": "https://s3-us-west-1.amazonaws.com/video-bucket/a149adbe3",
    71    "input-codec": "mp4",
    72    "output-codec": "webm",
    73    "quality": "1080p"
    74  }
    75  EOF
    76  Dispatched Job ID = video-encode/dispatch-1485379325-cb38d00d
    77  Evaluation ID     = 31199841
    78  
    79  ==> Monitoring evaluation "31199841"
    80      Evaluation triggered by job "example/dispatch-1485379325-cb38d00d"
    81      Allocation "8254b85f" created: node "82ff9c50", group "cache"
    82      Evaluation status changed: "pending" -> "complete"
    83  ==> Evaluation "31199841" finished with status "complete"
    84  ```
    85  
    86  Dispatch against a parameterized job with the ID "video-encode" and
    87  passing in a configuration payload via a file:
    88  
    89  ```
    90  $ nomad job dispatch video-encode video-config.json
    91  Dispatched Job ID = video-encode/dispatch-1485379325-cb38d00d
    92  Evaluation ID     = 31199841
    93  
    94  ==> Monitoring evaluation "31199841"
    95      Evaluation triggered by job "example/dispatch-1485379325-cb38d00d"
    96      Allocation "8254b85f" created: node "82ff9c50", group "cache"
    97      Evaluation status changed: "pending" -> "complete"
    98  ==> Evaluation "31199841" finished with status "complete"
    99  ```
   100  
   101  Dispatch against a parameterized job with the ID "video-encode" using the detach
   102  flag:
   103  
   104  ```
   105  $ nomad job dispatch -detach video-encode video-config.json
   106  Dispatched Job ID = example/dispatch-1485380684-c37b3dba
   107  Evaluation ID     = d9034c4e
   108  ```
   109  
   110  [parameterized job]: /docs/job-specification/parameterized.html "Nomad parameterized Job Specification"