Skip to main content

JobTemplate

Struct JobTemplate 

Source
pub struct JobTemplate {
    pub command: Vec<String>,
    pub environment: BTreeMap<String, String>,
    pub deadline: Option<Duration>,
    pub may_write_cache: bool,
}
Expand description

How the queue turns a speculative state into a executor::Job.

The queue knows which tree to test; it does not know what “test” means for a repository, and inventing a default command would make the wrong one silent. The default template has no command, which every real executor answers with executor::Verdict::Errored – loud, and never mistaken for a change that failed.

A template deliberately cannot name a working directory (D18). Every member of a batch is tested against a different speculative state, so one directory shared by the batch would test the last state repeatedly – well-formed, index-aligned, and wrong. The jobs this builds therefore leave executor::Job::directory unset, which asks the executor to materialize executor::Job::subject instead, the way crate::worktree::WorktreeRunner does for a git state. It is an invariant of the train rather than a knob, because there is no setting of it that would be right.

Fields§

§command: Vec<String>

The command, as argv.

§environment: BTreeMap<String, String>

Exactly what the child sees.

§deadline: Option<Duration>

Wall-clock ceiling per job. None uses executor::DEFAULT_DEADLINE.

§may_write_cache: bool

Whether these jobs may write a shared build cache.

Implementations§

Source§

impl JobTemplate

Source

pub fn job_for(&self, change: &Change, subject: ContentHash) -> Job

The job testing change applied on the state named by subject.

The subject is supplied rather than computed because only the Speculator knows how its states are named; see Speculator::subject.

Trait Implementations§

Source§

impl Clone for JobTemplate

Source§

fn clone(&self) -> JobTemplate

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for JobTemplate

Source§

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

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

impl Default for JobTemplate

Source§

fn default() -> JobTemplate

Returns the “default value” for a type. Read more

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.