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
impl ExecWorker
Sourcepub fn new(
nodes: Vec<String>,
command: String,
fanout: usize,
timeout: Option<Duration>,
) -> Self
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.
Sourcepub fn with_stderr(self, stderr: bool) -> Self
pub fn with_stderr(self, stderr: bool) -> Self
Create a new ExecWorker with stderr enabled.
Trait Implementations§
Source§impl Worker for ExecWorker
impl Worker for ExecWorker
Source§fn state(&self) -> WorkerState
fn state(&self) -> WorkerState
Get the worker’s current state.
Source§fn set_handler(&mut self, handler: Box<dyn EventHandler>)
fn set_handler(&mut self, handler: Box<dyn EventHandler>)
Set the event handler for this worker.
Source§fn handle_read(&mut self, fd: RawFd) -> Result<()>
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<()>
fn handle_write(&mut self, _fd: RawFd) -> Result<()>
Handle a write event on the given file descriptor.
Source§fn take_handler(&mut self) -> Option<Box<dyn EventHandler>>
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§
impl !RefUnwindSafe for ExecWorker
impl !Sync for ExecWorker
impl !UnwindSafe for ExecWorker
impl Freeze for ExecWorker
impl Send for ExecWorker
impl Unpin for ExecWorker
impl UnsafeUnpin for ExecWorker
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more