Trait TaskExecutionBackend

Source
pub trait TaskExecutionBackend: Send + Sync {
    // Required methods
    fn max_concurrency(&self) -> u64;
    fn constraints(
        &self,
        requirements: &HashMap<String, Value>,
        hints: &HashMap<String, Value>,
    ) -> Result<TaskExecutionConstraints>;
    fn guest_work_dir(&self) -> Option<&Path>;
    fn localize_inputs<'a, 'b, 'c, 'd>(
        &'a self,
        downloader: &'b HttpDownloader,
        inputs: &'c mut [Input],
    ) -> BoxFuture<'d, Result<()>>
       where Self: 'd,
             'a: 'd,
             'b: 'd,
             'c: 'd;
    fn spawn(
        &self,
        request: TaskSpawnRequest,
        token: CancellationToken,
    ) -> Result<TaskExecutionEvents>;

    // Provided method
    fn cleanup<'a, 'b, 'c>(
        &'a self,
        _output_dir: &'b Path,
        _token: CancellationToken,
    ) -> Option<BoxFuture<'c, ()>>
       where Self: 'c,
             'a: 'c,
             'b: 'c { ... }
}
Expand description

Represents a task execution backend.

Required Methods§

Source

fn max_concurrency(&self) -> u64

Gets the maximum concurrent tasks supported by the backend.

Source

fn constraints( &self, requirements: &HashMap<String, Value>, hints: &HashMap<String, Value>, ) -> Result<TaskExecutionConstraints>

Gets the execution constraints given a task’s requirements and hints.

Returns an error if the task cannot be constrained for the execution environment or if the task specifies invalid requirements.

Source

fn guest_work_dir(&self) -> Option<&Path>

Gets the guest path the task working directory (e.g. /mnt/work).

Returns None if the task execution does not use a container.

Source

fn localize_inputs<'a, 'b, 'c, 'd>( &'a self, downloader: &'b HttpDownloader, inputs: &'c mut [Input], ) -> BoxFuture<'d, Result<()>>
where Self: 'd, 'a: 'd, 'b: 'd, 'c: 'd,

Localizes the given set of inputs for the backend.

This may involve downloading remote inputs to the host and updating the input’s guest paths.

Source

fn spawn( &self, request: TaskSpawnRequest, token: CancellationToken, ) -> Result<TaskExecutionEvents>

Spawns a task with the execution backend.

Returns the task execution event receives upon success.

Provided Methods§

Source

fn cleanup<'a, 'b, 'c>( &'a self, _output_dir: &'b Path, _token: CancellationToken, ) -> Option<BoxFuture<'c, ()>>
where Self: 'c, 'a: 'c, 'b: 'c,

Performs cleanup operations after top-level workflow or task evaluation completes.

Returns None if no cleanup is required.

Implementors§