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_inputs_dir(&self) -> Option<&'static str>;
fn needs_local_inputs(&self) -> bool;
fn spawn(
&self,
request: TaskSpawnRequest,
token: CancellationToken,
) -> Result<Receiver<Result<TaskExecutionResult>>>;
// Provided method
fn cleanup<'a>(
&'a self,
work_dir: &'a EvaluationPath,
token: CancellationToken,
) -> Option<BoxFuture<'a, ()>> { ... }
}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_inputs_dir(&self) -> Option<&'static str>
fn guest_inputs_dir(&self) -> Option<&'static str>
Gets the guest (container) inputs directory of the backend.
Returns None if the backend does not execute tasks in a container.
The returned path is expected to be Unix style and end with a backslash.
Sourcefn needs_local_inputs(&self) -> bool
fn needs_local_inputs(&self) -> bool
Determines if the backend needs local inputs.
Backends that run tasks locally or from a shared file system will return
true.
Sourcefn spawn(
&self,
request: TaskSpawnRequest,
token: CancellationToken,
) -> Result<Receiver<Result<TaskExecutionResult>>>
fn spawn( &self, request: TaskSpawnRequest, token: CancellationToken, ) -> Result<Receiver<Result<TaskExecutionResult>>>
Spawns a task with the execution backend.
Returns a oneshot receiver for awaiting the completion of the task.
Provided Methods§
Sourcefn cleanup<'a>(
&'a self,
work_dir: &'a EvaluationPath,
token: CancellationToken,
) -> Option<BoxFuture<'a, ()>>
fn cleanup<'a>( &'a self, work_dir: &'a EvaluationPath, token: CancellationToken, ) -> Option<BoxFuture<'a, ()>>
Performs cleanup operations after task execution completes.
Returns None if no cleanup is required.