pub struct Task {Show 22 fields
pub artifacts: Vec<Artifact>,
pub config: Option<HashMap<String, DriverConfig>>,
pub constraints: Vec<Constraint>,
pub affinities: Vec<Affinity>,
pub spreads: Vec<Spread>,
pub dispatch_payload: Option<DispatchPayload>,
pub driver: String,
pub env: Option<HashMap<String, String>>,
pub kill_signal: String,
pub kill_timeout: Duration,
pub leader: bool,
pub log_config: LogConfig,
pub meta: Option<HashMap<String, String>>,
pub name: String,
pub resources: Resources,
pub restart_policy: RestartPolicy,
pub services: Vec<Service>,
pub shutdown_delay: Duration,
pub templates: Vec<Template>,
pub user: Option<String>,
pub vault: Option<Vault>,
pub lifecycle: Option<Lifecycle>,
}Expand description
Represents a task within a task group.
Fields§
§artifacts: Vec<Artifact>Represents the artifacts to download for this task.
config: Option<HashMap<String, DriverConfig>>A map of key-value configuration passed into the driver to start the task. The details of configurations are specific to each driver.
constraints: Vec<Constraint>The placement constraints for this job. See also Constraint
affinities: Vec<Affinity>A list to define placement preferences on nodes where a job can be run. See also Affinity
spreads: Vec<Spread>A list to define allocation spread across attributes. See also Spread
dispatch_payload: Option<DispatchPayload>Configures the task to have access to dispatch payloads. See also DispatchPayload
driver: StringSpecifies the task driver that should be used to run the task. See the driver documentation for what is available. Examples include docker, qemu, java, and exec.
env: Option<HashMap<String, String>>A map of key-value representing environment variables that will be passed along to the running process. Nomad variables are interpreted when set in the environment variable values.
kill_signal: StringSpecifies a configurable kill signal for a task, where the default is SIGINT. Note that this is only supported for drivers which accept sending signals
kill_timeout: DurationKillTimeout is a time duration in nanoseconds. It can be used to configure the time between signaling a task it will be killed and actually killing it. Drivers first sends a task the SIGINT signal and then sends SIGTERM if the task doesn’t die after the KillTimeout duration has elapsed. The default KillTimeout is 5 seconds.
leader: boolSpecifies whether the task is the leader task of the task group. If set to true, when the leader task completes, all other tasks within the task group will be gracefully shutdown.
log_config: LogConfigThis allows configuring log rotation for the stdout and stderr buffers of a Task.
meta: Option<HashMap<String, String>>A key-value map that annotates the Consul service with user-defined metadata. String interpolation is supported in meta.
name: StringThe name of the task.
resources: ResourcesProvides the resource requirements of the task. See also Resources
restart_policy: RestartPolicySpecifies the restart policy to be applied to tasks in this group. If omitted, a default policy for batch and non-batch jobs is used based on the job type. See also RestartPolicy
services: Vec<Service>A Service object represents a routable and discoverable service on the network. Nomad integrates with Consul for service discovery and it automatically registers when a task is started and de-registers it when the task transitions to the dead state. See also Service Note that this is deprecated and replaced by the services stanza at the task group level.
shutdown_delay: DurationSpecifies the duration to wait when killing a task between removing it from Consul and sending it a shutdown signal. Ideally services would fail healthchecks once they receive a shutdown signal. Alternatively ShutdownDelay may be set to give in flight requests time to complete before shutting down.
templates: Vec<Template>Specifies the set of Template objects to render for the task. Templates can be used to inject both static and dynamic configuration with data populated from environment variables, Consul and Vault. See also Template
user: Option<String>Set the user that will run the task. It defaults to the same user the Nomad client is being run as. This can only be set on Linux platforms.
vault: Option<Vault>The vault configuration, if any.
lifecycle: Option<Lifecycle>The lifecycle configuration for the task, if any. See also Template
Trait Implementations§
Source§impl Default for Task
impl Default for Task
Source§fn default() -> Self
fn default() -> Self
Return Task { artifacts: Default::default(), config: Default::default(), constraints: Default::default(), affinities: Default::default(), spreads: Default::default(), dispatch_payload: Default::default(), driver: Default::default(), env: Default::default(), kill_signal: ("SIGINT").into(), kill_timeout: Duration :: from_secs(5), leader: Default::default(), log_config: Default::default(), meta: Default::default(), name: Default::default(), resources: Default::default(), restart_policy: Default::default(), services: Default::default(), shutdown_delay: Default::default(), templates: Default::default(), user: Default::default(), vault: Default::default(), lifecycle: Default::default() }