Skip to main content

run_job

Function run_job 

Source
pub fn run_job(
    spec: &JobSpec,
    executor: &dyn JobExecutor,
    policy: VerifyPolicy,
    escrow: Option<&mut Escrow>,
) -> Result<DispatchOutcome, SwarmError>
Expand description

Run a job: execute it on executor, independently verify the result, and — for a Paid job — settle the supplied escrow by the verdict. The escrow must already be Held (funds committed) for a paid job; if it is missing for a paid job, the job is still executed and verified but no settlement is produced (a caller error surfaced as None, never an unguarded payment).

Invariant: a provider payment instruction is emitted only when verification returns Verified. There is no code path from a Rejected verdict to a Pay.