Skip to content

parallel

parallel #

cg.procedure_set() — collect a block into a ProcedureSet.

The block's leftover roots run concurrently; a set has no defined order. A path cached inside the block stays assigned and readable for the rest of the procedure.

SetContext #

Bases: ProcedureContext

Reduce a block's roots to a ProcedureSet (concurrent execution).

Source code in capturegraph-lib/capturegraph/procedures/procedure/authoring/contexts/parallel.py
class SetContext(ProcedureContext):
    """Reduce a block's roots to a ``ProcedureSet`` (concurrent execution)."""

    def _finish(self) -> None:
        from capturegraph.procedures.nodes.process.structural import (
            ProcedureSet,
        )

        ProcedureSet(procedures=self._step_roots())

procedure_set() #

Run the with block's steps concurrently, as one enclosing-context step.

Source code in capturegraph-lib/capturegraph/procedures/procedure/authoring/contexts/parallel.py
@contextmanager
def procedure_set() -> Iterator[None]:
    """Run the ``with`` block's steps concurrently, as one enclosing-context step."""
    with SetContext().collect():
        yield