github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/website/pages/docs/commands/job/dispatch.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: 'Commands: job dispatch'
     4  sidebar_title: 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  ```plaintext
    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  @include 'general_options.mdx'
    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] 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  ```shell-sessioncat << EOF | nomad job dispatch video-encode -
    67  {
    68    "s3-input": "https://video-bucket.s3-us-west-1.amazonaws.com/cb31dabb1",
    69    "s3-output": "https://video-bucket.s3-us-west-1.amazonaws.com/a149adbe3",
    70    "input-codec": "mp4",
    71    "output-codec": "webm",
    72    "quality": "1080p"
    73  }
    74  EOF
    75  Dispatched Job ID = video-encode/dispatch-1485379325-cb38d00d
    76  Evaluation ID     = 31199841
    77  
    78  ==> Monitoring evaluation "31199841"
    79      Evaluation triggered by job "example/dispatch-1485379325-cb38d00d"
    80      Allocation "8254b85f" created: node "82ff9c50", group "cache"
    81      Evaluation status changed: "pending" -> "complete"
    82  ==> Evaluation "31199841" finished with status "complete"
    83  ```
    84  
    85  Dispatch against a parameterized job with the ID "video-encode" and
    86  passing in a configuration payload via a file:
    87  
    88  ```shell-sessionnomad job dispatch video-encode video-config.json
    89  Dispatched Job ID = video-encode/dispatch-1485379325-cb38d00d
    90  Evaluation ID     = 31199841
    91  
    92  ==> Monitoring evaluation "31199841"
    93      Evaluation triggered by job "example/dispatch-1485379325-cb38d00d"
    94      Allocation "8254b85f" created: node "82ff9c50", group "cache"
    95      Evaluation status changed: "pending" -> "complete"
    96  ==> Evaluation "31199841" finished with status "complete"
    97  ```
    98  
    99  Dispatch against a parameterized job with the ID "video-encode" using the detach
   100  flag:
   101  
   102  ```shell-sessionnomad job dispatch -detach video-encode video-config.json
   103  Dispatched Job ID = example/dispatch-1485380684-c37b3dba
   104  Evaluation ID     = d9034c4e
   105  ```
   106  
   107  [eval status]: /docs/commands/eval-status
   108  [parameterized job]: /docs/job-specification/parameterized 'Nomad parameterized Job Specification'