pub struct Running<'r> { /* private fields */ }Expand description
A run: a manifest under a name, on a runner.
Implementations§
Source§impl Running<'_>
impl Running<'_>
Sourcepub async fn attach(
&self,
machine: Option<&str>,
network: Option<&str>,
image: Option<&str>,
events: &dyn Events,
) -> Result<AttachReport>
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.
Sourcepub async fn detach(
&self,
machine: Option<&str>,
events: &dyn Events,
) -> Result<()>
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.
Sourcepub fn shell_command(&self, machine: Option<&str>) -> Result<ShellCommand>
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<'_>
impl Running<'_>
Sourcepub async fn down(&self, opts: &RunOptions, events: &dyn Events) -> Result<()>
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.
Sourcepub async fn park(&self, mode: Park, events: &dyn Events) -> Result<()>
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.
Sourcepub async fn resume(
&self,
opts: &RunOptions,
events: &dyn Events,
) -> Result<Started>
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.
Sourcepub async fn check(
&self,
opts: &RunOptions,
events: &dyn Events,
) -> Result<CheckReport>
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).
Sourcepub async fn provision(
&self,
machine: Option<&str>,
opts: &RunOptions,
events: &dyn Events,
) -> Result<()>
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<'_>
impl Running<'_>
Sourcepub async fn up(
&self,
opts: &RunOptions,
events: &dyn Events,
) -> Result<Started>
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>
impl<'r> Running<'r>
Sourcepub fn with_connection(self, secrets: Secrets) -> Running<'r>
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.
Sourcepub async fn status(&self) -> Result<Status>
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.