pub enum WorkerOutput {
Completed(HashMap<String, Value>),
Failed(String),
FailedWithTerminalError(String),
InProgress(TaskInProgress),
}Expand description
Output type for worker execution.
Variants§
Completed(HashMap<String, Value>)
Task completed successfully with output.
Failed(String)
Task failed with an error message — retried by the server per the task’s retry policy.
FailedWithTerminalError(String)
Task failed permanently and should not be retried (FAILED_WITH_TERMINAL_ERROR).
Return this instead of WorkerOutput::Failed — or instead of a plain Err from
Worker::execute, which always maps to WorkerOutput::Failed in task_runner.rs —
when the failure is definitively not worth retrying (a malformed input that will fail
identically every time, a missing local dependency like an interpreter binary, etc.).
There is currently no way to signal this from an Err return; a worker that needs it
must construct this variant directly and return it via Ok(...).
InProgress(TaskInProgress)
Task is still in progress (for long-running tasks).
Implementations§
Source§impl WorkerOutput
impl WorkerOutput
Sourcepub fn completed_with_result(result: impl Serialize) -> Self
pub fn completed_with_result(result: impl Serialize) -> Self
Create a completed output with a single result value.
Sourcepub fn in_progress(callback_after_seconds: i64) -> Self
pub fn in_progress(callback_after_seconds: i64) -> Self
Create an in-progress output.
Sourcepub fn into_task_result(self, task: &Task, worker_id: &str) -> TaskResult
pub fn into_task_result(self, task: &Task, worker_id: &str) -> TaskResult
Convert to TaskResult.