Skip to main content

ExecWorker

Struct ExecWorker 

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

Worker implementation that runs commands on nodes via local execution.

ExecWorker spawns child processes to execute commands on nodes. It supports fanout control (limiting concurrent processes) and node name substitution in commands (%h or {node}).

Implementations§

Source§

impl ExecWorker

Source

pub fn new( nodes: Vec<String>, command: String, fanout: usize, timeout: Option<Duration>, ) -> Self

Create a new ExecWorker.

§Arguments
  • nodes - List of node names to execute the command on.
  • command - Command to execute. Use %h or {node} as placeholders for the node name.
  • fanout - Maximum number of concurrent processes (default: 64).
  • timeout - Optional timeout per node.
Source

pub fn with_stderr(self, stderr: bool) -> Self

Create a new ExecWorker with stderr enabled.

Trait Implementations§

Source§

impl Worker for ExecWorker

Source§

fn start(&mut self) -> Result<()>

Start the worker.
Source§

fn abort(&mut self, kill: bool)

Abort the worker, optionally killing child processes.
Source§

fn state(&self) -> WorkerState

Get the worker’s current state.
Source§

fn set_handler(&mut self, handler: Box<dyn EventHandler>)

Set the event handler for this worker.
Source§

fn read_fds(&self) -> Vec<RawFd> ⓘ

Get file descriptors for read interest.
Source§

fn write_fds(&self) -> Vec<RawFd> ⓘ

Get file descriptors for write interest.
Source§

fn handle_read(&mut self, fd: RawFd) -> Result<()>

Handle a read event on the given file descriptor.
Source§

fn handle_write(&mut self, _fd: RawFd) -> Result<()>

Handle a write event on the given file descriptor.
Source§

fn is_done(&self) -> bool

Check if the worker has completed.
Source§

fn retcodes(&self) -> &HashMap<String, i32>

Get the return codes map: node -> return_code.
Source§

fn num_nodes(&self) -> usize

Get the number of nodes.
Source§

fn take_handler(&mut self) -> Option<Box<dyn EventHandler>>

Take the event handler out of the worker (used by Task to extract gathered data).

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> 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, 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.