Skip to main content

TaskSpec

Struct TaskSpec 

Source
pub struct TaskSpec { /* private fields */ }
Expand description

Desired state specification.

TaskSpec describes what should be run and how it should be managed by the runtime.

Fields cover:

  • logical grouping (slot)
  • execution backend (kind)
  • concurrency control (admission)
  • lifecycle policies (timeout, restart, backoff)

§Also

Implementations§

Source§

impl TaskSpec

Source

pub fn slot(&self) -> &Slot

Logical slot name for concurrency control.

Source

pub fn kind(&self) -> &TaskKind

Execution backend used to run the task.

Source

pub fn timeout(&self) -> Timeout

Hard timeout in milliseconds.

Source

pub fn restart(&self) -> RestartPolicy

Restart policy applied after completion or failure.

Source

pub fn backoff(&self) -> &BackoffPolicy

Backoff configuration between restart attempts.

Source

pub fn admission(&self) -> AdmissionPolicy

Admission policy for handling slot conflicts.

Source

pub fn runner_selector(&self) -> Option<&RunnerSelector>

Label selector for runner routing (if present).

Source

pub fn labels(&self) -> &Labels

Metadata labels for routing / scheduling / observability.

Source§

impl TaskSpec

Source

pub fn builder( slot: impl Into<Slot>, kind: TaskKind, timeout: impl Into<Timeout>, ) -> TaskSpecBuilder

Create a TaskSpecBuilder with the three required fields.

use solti_model::{TaskSpec, TaskKind, SubprocessSpec, SubprocessMode, RestartPolicy};

let spec = TaskSpec::builder(
    "my-slot",
    TaskKind::Subprocess(SubprocessSpec {
        mode: SubprocessMode::Command {
            command: "echo".into(),
            args: vec!["hello".into()],
        },
        env: Default::default(),
        cwd: None,
        fail_on_non_zero: Default::default(),
    }),
    5_000u64,
)
.restart(RestartPolicy::OnFailure)
.build()
.expect("valid spec");
Source§

impl TaskSpec

Source

pub fn with_runner_selector(self, sel: RunnerSelector) -> Self

Attach a runner selector used by the router (consuming builder-style).

Source§

impl TaskSpec

Source

pub fn validate(&self) -> ModelResult<()>

Validate the spec at the submit boundary.

Trait Implementations§

Source§

impl Clone for TaskSpec

Source§

fn clone(&self) -> TaskSpec

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TaskSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for TaskSpec

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for TaskSpec

Source§

fn eq(&self, other: &TaskSpec) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for TaskSpec

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for TaskSpec

Source§

impl StructuralPartialEq for TaskSpec

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,