pub struct Job {
pub id: String,
pub name: String,
pub job_type: JobType,
pub groups: Vec<TaskGroup>,
pub priority: u8,
pub datacenters: Vec<String>,
pub state: JobState,
pub metadata: HashMap<String, String>,
pub created_at: DateTime<Utc>,
}Expand description
Top-level job definition
Fields§
§id: StringUnique job ID
name: StringJob name
job_type: JobTypeJob type
groups: Vec<TaskGroup>Task groups
priority: u8Job priority (0-100)
datacenters: Vec<String>Datacenter constraints
state: JobStateJob state
metadata: HashMap<String, String>Job metadata
created_at: DateTime<Utc>Creation timestamp
Implementations§
Source§impl Job
impl Job
Sourcepub fn with_group(self, group_name: impl Into<String>, task: Task) -> Self
pub fn with_group(self, group_name: impl Into<String>, task: Task) -> Self
Add a task group with a single task
Sourcepub fn datacenters(self, dcs: Vec<impl Into<String>>) -> Self
pub fn datacenters(self, dcs: Vec<impl Into<String>>) -> Self
Set datacenters
Sourcepub fn task_count(&self) -> usize
pub fn task_count(&self) -> usize
Get total task count across all groups
Sourcepub fn desired_count(&self) -> u32
pub fn desired_count(&self) -> u32
Get total desired instance count
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Job
impl<'de> Deserialize<'de> for Job
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Job
impl RefUnwindSafe for Job
impl Send for Job
impl Sync for Job
impl Unpin for Job
impl UnwindSafe for Job
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more