Skip to main content

Running

Struct Running 

Source
pub struct Running<'r> { /* private fields */ }
Expand description

A run: a manifest under a name, on a runner.

Implementations§

Source§

impl Running<'_>

Source

pub async fn attach( &self, machine: Option<&str>, network: Option<&str>, image: Option<&str>, events: &dyn Events, ) -> Result<AttachReport>

Hot-adds the on-demand access machine into the running run: brings its box up with the learner-picked image (its baked default otherwise), on network when given. machine names which on-demand machine, needed only when the lab has more than one.

§Errors

Fails with machine_unknown for a named machine the lab has no on-demand machine for, unsupported when the lab has no on-demand machine (or more than one and none is named, or the target is a cloud one), not_running when the run isn’t up, and as the other operations do for a step or the state.

Source

pub async fn detach( &self, machine: Option<&str>, events: &dyn Events, ) -> Result<()>

Hot-removes the on-demand access machine from the running run, leaving the rest up.

§Errors

Fails as Running::attach does for the machine choice and the target, and as the other operations do for a step or the state.

Source

pub fn shell_command(&self, machine: Option<&str>) -> Result<ShellCommand>

The command that opens an interactive shell into the on-demand access machine: the runner builds it from the run’s Compose project / Vagrant define, so the embedder opens the box by service or define name and never reconstructs a container name. A pure query — it runs nothing, emits nothing, and doesn’t check the box is up (the embedder runs what it returns in its own terminal once the box is attached).

§Errors

Fails as Running::attach does for the machine choice, and unsupported on a cloud target (its attacker runs locally, not in the cloud).

Source§

impl Running<'_>

Source

pub async fn down(&self, opts: &RunOptions, events: &dyn Events) -> Result<()>

Removes everything the run created (containers, networks, volumes).

§Errors

Fails, after its error event, when the run is recorded elsewhere, a down step fails, or the run’s state can’t be locked or written.

Source

pub async fn park(&self, mode: Park, events: &dyn Events) -> Result<()>

Stops the run, keeping what it created, with the manifest’s park steps for mode.

§Errors

Fails with not_parkable when the manifest has no steps for mode, with not_running when nothing of the run is there, and as Running::down does for a step or the state.

Source

pub async fn resume( &self, opts: &RunOptions, events: &dyn Events, ) -> Result<Started>

Starts a parked run again, as it was: nothing is re-created, so inputs aren’t needed again.

§Errors

Fails with nothing_to_resume when nothing is left (the parked mark is dropped), and as Running::up does for a tool, a step, a ready condition or the state.

Source

pub async fn check( &self, opts: &RunOptions, events: &dyn Events, ) -> Result<CheckReport>

Runs the run’s checks against the running run.

§Errors

Fails with not_running when no target machine runs, and when a setup or teardown step fails. A failing check isn’t an error: the report says it (ok: false).

Source

pub async fn provision( &self, machine: Option<&str>, opts: &RunOptions, events: &dyn Events, ) -> Result<()>

Runs the run’s set-up again on its running machines, every one or machine (a run machine of the manifest), without rebuilding them: the manifest’s provision steps. The values given at launch aren’t kept by the runner: pass them again in opts.

§Errors

Fails with machine_unknown for a machine the run doesn’t have, not_running when no target machine runs, unsupported when the manifest has no provision steps, and as Running::up does for a step or the state.

Source§

impl Running<'_>

Source

pub async fn up( &self, opts: &RunOptions, events: &dyn Events, ) -> Result<Started>

Starts the run: refused while it runs or runs elsewhere; a parked run is resumed (with Occupied::ResumeParked); leftovers are removed first.

§Errors

Fails, after its error event, when the run is up already (already_running) or recorded elsewhere (running_elsewhere); when a param, secret or tool is missing or refused; when a host port is taken (port_in_use); when a step fails or runs out of time (tool_failed, tool_missing, timeout); when a ready condition doesn’t hold (not_ready); or when the run’s state can’t be locked or written (locked, io).

Source§

impl<'r> Running<'r>

Source

pub fn with_connection(self, secrets: Secrets) -> Running<'r>

The run with secrets, the values of its connection slots (an ESXi host’s password), delivered to every operation: status and park, which take no options, too. Kept in memory only, never stored; a value an operation’s options give wins.

Source

pub fn manifest(&self) -> &Manifest

The manifest.

Source

pub fn name(&self) -> &RunName

The run’s name.

Source

pub fn path(&self) -> &Path

The manifest’s file.

Source

pub async fn status(&self) -> Result<Status>

The run as it stands: read-only, never locked, and never an event.

§Errors

Fails when the engine can’t be asked (the status step fails or runs out of time) or the run’s record can’t be read.

Source

pub async fn outputs(&self) -> Result<Vec<OutputValue>>

The run’s outputs, read live.

§Errors

Fails as Running::status does.

Trait Implementations§

Source§

impl Debug for Running<'_>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'r> !RefUnwindSafe for Running<'r>

§

impl<'r> !UnwindSafe for Running<'r>

§

impl<'r> Freeze for Running<'r>

§

impl<'r> Send for Running<'r>

§

impl<'r> Sync for Running<'r>

§

impl<'r> Unpin for Running<'r>

§

impl<'r> UnsafeUnpin for Running<'r>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more