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§
Sourcefn max_concurrency(&self) -> u64
fn max_concurrency(&self) -> u64
Gets the maximum concurrent tasks supported by the backend.
Sourcefn constraints(
&self,
requirements: &HashMap<String, Value>,
hints: &HashMap<String, Value>,
) -> Result<TaskExecutionConstraints>
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.
Sourcefn guest_work_dir(&self) -> Option<&Path>
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.
Sourcefn 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 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.
Sourcefn spawn(
&self,
request: TaskSpawnRequest,
token: CancellationToken,
) -> Result<TaskExecutionEvents>
fn spawn( &self, request: TaskSpawnRequest, token: CancellationToken, ) -> Result<TaskExecutionEvents>
Spawns a task with the execution backend.
Returns the task execution event receives upon success.