pub fn fork_workflow<'a, R: 'a, E: 'a>(
workflow_id: &'a str,
start_step: i32,
) -> PendingStart<'a, R, E> ⓘExpand description
Forks a workflow from start_step, from inside another workflow, and hands back the fork’s
handle.
The free form of DBOS::fork, for a workflow body — a supervisor re-running a failed child
from the step that failed — that has no DBOS to call it on and should not capture one: see
cancel_workflow for the cycle that capture would make.
Checkpointed in the transaction that writes the fork, under DBOS.forkWorkflow, because
the same body builds this and the method. That is what matters most here: a fork generates a
new id, so a replay without the checkpoint would write a second fork. A replay hands back the
id the first execution recorded.
Error::NotInWorkflow outside a workflow; plain inside a step. A PendingStart, as
resume_workflow is.
let steps = dbos::list_workflow_steps::<dbos::EngineOnly>(&failed).await?;
let at = steps.iter().rev().find(|s| s.error.is_some()).map_or(0, |s| s.step_id);
let fork = dbos::fork_workflow::<u32, dbos::EngineOnly>(&failed, at).await?;
fork.result().await