Skip to main content

Executor

Trait Executor 

Source
pub trait Executor:
    Clone
    + Send
    + Sync
    + 'static {
    // Required methods
    fn run(
        &self,
        spec: AttemptSpec,
        plan: Plan,
        stop: Stops,
        spawned: Spawned,
        ended: TaskEnded,
    ) -> impl Future<Output = Finished> + Send;
    fn cleanup(
        &self,
        spec: AttemptSpec,
        ended: Finished,
        handles: Vec<CleanupHandle>,
        spawned: Spawned,
    ) -> impl Future<Output = Finished> + Send;
    fn parse(
        &self,
        root: String,
        dir: PathBuf,
        files: Vec<String>,
        code: ParseCode,
    ) -> impl Future<Output = Result<Vec<ParsedFile>, String>> + Send;

    // Provided methods
    fn warnings(&self) -> Receiver<Vec<WorkerWarning>> { ... }
    fn code_changed(&self, _copies: BTreeMap<String, PathBuf>) { ... }
    fn code_in_use(&self) -> Vec<String> { ... }
    fn watcher_hosts(&self) -> Vec<WatcherHost> { ... }
    fn memory_parts(&self) -> (u64, Vec<TaskMemory>) { ... }
    fn connection_job(
        &self,
        job: ConnectionJob,
        spawned: Spawned,
    ) -> impl Future<Output = Vec<ConnectionReport>> + Send { ... }
}
Expand description

Runs attempts and parse jobs.

Required Methods§

Source

fn run( &self, spec: AttemptSpec, plan: Plan, stop: Stops, spawned: Spawned, ended: TaskEnded, ) -> impl Future<Output = Finished> + Send

Runs a planned attempt until it ends or stop says why to stop it (a later reason may hurry a stop under way, see crate::supervise::supervise), telling spawned its process, and ended the task’s result before its cleanup starts; returns its Finished.

Source

fn cleanup( &self, spec: AttemptSpec, ended: Finished, handles: Vec<CleanupHandle>, spawned: Spawned, ) -> impl Future<Output = Finished> + Send

Runs the cleanup of an attempt an earlier agent left, whose task ended as ended, with the handles the journal kept; returns ended with the cleanup’s result.

Source

fn parse( &self, root: String, dir: PathBuf, files: Vec<String>, code: ParseCode, ) -> impl Future<Output = Result<Vec<ParsedFile>, String>> + Send

Parses files of the root root in dir, with the other roots’ copies code.

Provided Methods§

Source

fn warnings(&self) -> Receiver<Vec<WorkerWarning>>

What is wrong with the worker now, as it changes (sent to the master); none by default.

Source

fn code_changed(&self, _copies: BTreeMap<String, PathBuf>)

The worker’s newest copy of each DAG root: what runs may move to it.

Source

fn code_in_use(&self) -> Vec<String>

Folders of code copies in use besides the attempts’ own.

Source

fn watcher_hosts(&self) -> Vec<WatcherHost>

The wait step hosts as last looked at, for the heartbeat: it can’t wait.

Source

fn memory_parts(&self) -> (u64, Vec<TaskMemory>)

Its fork servers’ memory together and its running tasks’, largest first, as last measured, for the heartbeat (decision 463): it can’t wait.

Source

fn connection_job( &self, job: ConnectionJob, spawned: Spawned, ) -> impl Future<Output = Vec<ConnectionReport>> + Send

Checks a root’s connections, or tests one (schedr connections check / test); a report for each. An executor without secrets says it can’t. A test tells spawned its process, as an attempt does (the journal records it, so a worker killed meanwhile stops it when it starts again).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§