MCPcopy Index your code
hub / github.com/AI45Lab/Code / parallel_resumable

Method parallel_resumable

sdk/python/src/lib.rs:1557–1587  ·  view source on GitHub ↗

Like `parallel`, but resumable: progress is journaled under `workflow_id` via the session's store, so an interrupted run skips already-completed steps. Raises if no `session_store` is configured.

(
        &self,
        py: Python<'_>,
        specs: Vec<Bound<'_, PyAny>>,
        workflow_id: String,
    )

Source from the content-addressed store, hash-verified

1555 /// `workflow_id` via the session's store, so an interrupted run skips
1556 /// already-completed steps. Raises if no `session_store` is configured.
1557 fn parallel_resumable(
1558 &self,
1559 py: Python<'_>,
1560 specs: Vec<Bound<'_, PyAny>>,
1561 workflow_id: String,
1562 ) -> PyResult<Vec<PyObject>> {
1563 let rust_specs = specs
1564 .iter()
1565 .map(|s| py_to_step_spec(py, s))
1566 .collect::<PyResult<Vec<_>>>()?;
1567 let session = self.inner.clone();
1568 let outcomes = py
1569 .allow_threads(move || {
1570 get_runtime().block_on(async move {
1571 let Some(store) = session.session_store() else {
1572 return Err("parallel_resumable requires a session_store on the session");
1573 };
1574 let executor = session.agent_executor();
1575 Ok(execute_steps_parallel_resumable(
1576 executor,
1577 rust_specs,
1578 &workflow_id,
1579 store,
1580 None,
1581 )
1582 .await)
1583 })
1584 })
1585 .map_err(PyRuntimeError::new_err)?;
1586 outcomes.iter().map(|o| step_outcome_to_py(py, o)).collect()
1587 }
1588
1589 /// Run each item through a chain of `stages`, with no barrier between
1590 /// stages. Each stage is a callable `stage(ctx) -> spec_dict | None`, where

Callers

nothing calls this directly

Calls 8

py_to_step_specFunction · 0.85
step_outcome_to_pyFunction · 0.85
block_onMethod · 0.80
session_storeMethod · 0.80
agent_executorMethod · 0.80
get_runtimeFunction · 0.70
cloneMethod · 0.45

Tested by

no test coverage detected