mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
JSON job
This commit is contained in:
@@ -137,7 +137,10 @@ Below is an example of a JSON object that submits a `periodic` job to Nomad:
|
||||
},
|
||||
"RelativeDest":"local/"
|
||||
}
|
||||
]
|
||||
],
|
||||
"DispatchPayload": {
|
||||
"File": "config.json"
|
||||
}
|
||||
}
|
||||
],
|
||||
"RestartPolicy":{
|
||||
@@ -165,7 +168,17 @@ Below is an example of a JSON object that submits a `periodic` job to Nomad:
|
||||
"Meta":{
|
||||
"foo":"bar",
|
||||
"baz":"pipe"
|
||||
}
|
||||
},
|
||||
"ParameterizedJob": {
|
||||
"Payload": "required",
|
||||
"MetaRequired": [
|
||||
"foo"
|
||||
],
|
||||
"MetaOptional": [
|
||||
"bar"
|
||||
]
|
||||
},
|
||||
"Payload": null
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -194,6 +207,24 @@ The `Job` object supports the following keys:
|
||||
|
||||
* `Meta` - Annotates the job with opaque metadata.
|
||||
|
||||
* `ParameterizedJob` - Specifies the job as a paramterized job such that it can
|
||||
be dispatched against. The `ParamaterizedJob` object supports the following
|
||||
attributes:
|
||||
|
||||
* `MetaOptional` - Specifies the set of metadata keys that may be provided
|
||||
when dispatching against the job as a string array.
|
||||
|
||||
* `MetaRequired` - Specifies the set of metadata keys that must be provided
|
||||
when dispatching against the job as a string array.
|
||||
|
||||
* `Payload` - Specifies the requirement of providing a payload when
|
||||
dispatching against the parameterized job. The options for this field are
|
||||
"optional", "required" and "forbidden"
|
||||
|
||||
* `Payload` - The payload may not be set when submitting a job but may appear in
|
||||
a dispatched job. The `Payload` will be a base64 encoded string containing the
|
||||
payload that the job was dispatched with.
|
||||
|
||||
* `Priority` - Specifies the job priority which is used to prioritize
|
||||
scheduling and access to resources. Must be between 1 and 100 inclusively,
|
||||
and defaults to 50.
|
||||
@@ -295,6 +326,12 @@ The `Task` object supports the following keys:
|
||||
* `Constraints` - This is a list of `Constraint` objects. See the constraint
|
||||
reference for more details.
|
||||
|
||||
- `DispatchPayload` - Configures the task to have access to dispatch payloads.
|
||||
The `DispatchPayload` object supports the following attributes:
|
||||
|
||||
* `File` - Specifies the file name to write the content of dispatch payload
|
||||
to. The file is written relative to the task's local directory.
|
||||
|
||||
* `Driver` - Specifies the task driver that should be used to run the
|
||||
task. See the [driver documentation](/docs/drivers/index.html) for what
|
||||
is available. Examples include `docker`, `qemu`, `java`, and `exec`.
|
||||
|
||||
@@ -39,7 +39,7 @@ job "docs" {
|
||||
## `dispatch_payload` Parameters
|
||||
|
||||
- `file` `(string: "")` - Specifies the file name to write the content of
|
||||
dispatch payload to. The file is written to a [task's local
|
||||
dispatch payload to. The file is written relative to the [task's local
|
||||
directory][localdir].
|
||||
|
||||
## `dispatch_payload` Examples
|
||||
|
||||
@@ -42,6 +42,10 @@ job "docs" {
|
||||
"my-key" = "my-value"
|
||||
}
|
||||
|
||||
parameterized {
|
||||
# ...
|
||||
}
|
||||
|
||||
periodic {
|
||||
# ...
|
||||
}
|
||||
@@ -74,13 +78,16 @@ job "docs" {
|
||||
- `datacenters` `(array<string>: <required>)` - A list of datacenters in the region which are eligible
|
||||
for task placement. This must be provided, and does not have a default.
|
||||
|
||||
- `group` <code>([Group][group]: <required>)</code> - Specifies the start of a
|
||||
- `group` <code>([Group][group]: \<required\>)</code> - Specifies the start of a
|
||||
group of tasks. This can be provided multiple times to define additional
|
||||
groups. Group names must be unique within the job file.
|
||||
|
||||
- `meta` <code>([Meta][]: nil)</code> - Specifies a key-value map that annotates
|
||||
with user-defined metadata.
|
||||
|
||||
- `parameterized` <code>([Parameterized][parameterized]: nil)</code> - Specifies
|
||||
the job as a paramterized job such that it can be dispatched against.
|
||||
|
||||
- `periodic` <code>([Periodic][]: nil)</code> - Allows the job to be scheduled
|
||||
at fixed times, dates or intervals.
|
||||
|
||||
@@ -215,6 +222,7 @@ $ VAULT_TOKEN="..." nomad run example.nomad
|
||||
[constraint]: /docs/job-specification/constraint.html "Nomad constraint Job Specification"
|
||||
[group]: /docs/job-specification/group.html "Nomad group Job Specification"
|
||||
[meta]: /docs/job-specification/meta.html "Nomad meta Job Specification"
|
||||
[parameterized]: /docs/job-specification/parameterized.html "Nomad parameterized Job Specification"
|
||||
[periodic]: /docs/job-specification/periodic.html "Nomad periodic Job Specification"
|
||||
[task]: /docs/job-specification/task.html "Nomad task Job Specification"
|
||||
[update]: /docs/job-specification/update.html "Nomad update Job Specification"
|
||||
|
||||
@@ -66,10 +66,10 @@ job "docs" {
|
||||
|
||||
## `parameterized` Parameters
|
||||
|
||||
- `meta_optional` `([]string: nil)` - Specifies the set of metadata keys that
|
||||
- `meta_optional` `(array<string>: nil)` - Specifies the set of metadata keys that
|
||||
may be provided when dispatching against the job.
|
||||
|
||||
- `meta_required` `([]string: nil)` - Specifies the set of metadata keys that
|
||||
- `meta_required` `(array<string>: nil)` - Specifies the set of metadata keys that
|
||||
must be provided when dispatching against the job.
|
||||
|
||||
- `payload` `(string: "optional")` - Specifies the requirement of providing a
|
||||
|
||||
@@ -37,6 +37,9 @@ job "docs" {
|
||||
constraints on the task. This can be provided multiple times to define
|
||||
additional constraints.
|
||||
|
||||
- `dispatch_payload` <code>([DispatchPayload][]: nil)</code> - Configures the
|
||||
task to have access to dispatch payloads.
|
||||
|
||||
- `driver` - Specifies the task driver that should be used to run the
|
||||
task. See the [driver documentation](/docs/drivers/index.html) for what
|
||||
is available. Examples include `docker`, `qemu`, `java`, and `exec`.
|
||||
@@ -163,6 +166,7 @@ task "server" {
|
||||
[artifact]: /docs/job-specification/artifact.html "Nomad artifact Job Specification"
|
||||
[consul]: https://www.consul.io/ "Consul by HashiCorp"
|
||||
[constraint]: /docs/job-specification/constraint.html "Nomad constraint Job Specification"
|
||||
[dispatchpayload]: /docs/job-specification/dispatch-payload.html "Nomad dispatch_payload Job Specification"
|
||||
[env]: /docs/job-specification/env.html "Nomad env Job Specification"
|
||||
[meta]: /docs/job-specification/meta.html "Nomad meta Job Specification"
|
||||
[resources]: /docs/job-specification/resources.html "Nomad resources Job Specification"
|
||||
|
||||
Reference in New Issue
Block a user