stoner_measurement.plugins.sequence.containers.RunParallelPlugin

class stoner_measurement.plugins.sequence.containers.RunParallelPlugin(parent: QObject | None = None)[source]

Bases: _FunctionSequencePlugin

Run each immediate nested step concurrently and wait for all to finish.

Use this sequence container when independent operations can run at the same time, such as measurements on different instruments or plotting and saving the same completed data. Each immediate child is one parallel branch. To run several ordered steps within a branch, place them inside a RunSequentiallyPlugin child.

The configuration panel contains a General tab for the instance name and optional sequence-list comment. There are no plugin-specific settings. The About tab contains this documentation.

Generated sequence code defines one helper function for each active child. Each name combines this container’s instance_name with the child instance name, for example _run_parallel_fit_branch. Repeated child names receive a numeric suffix. execute() starts one worker thread per helper and blocks until every submitted branch has completed. If a branch fails, all other submitted branches are still allowed to finish; the exception is then propagated to the sequence engine so the run is reported as failed.

Parallel branches share the sequence engine namespace. Use independent instruments or read-only inputs unless the child plugins explicitly provide synchronisation. Do not place operations with a data dependency in separate branches, and do not access the same hardware driver from multiple branches unless that driver is documented as thread-safe.

This plugin has no hardware lifecycle, configuration values, or reported data outputs of its own. The contained plugins retain their normal lifecycles and outputs.

Variables:
  • instance_name (str) – Python identifier used for this container and as the prefix for generated parallel-branch helper functions.

  • comment (str) – Optional note displayed beside this step in the sequence tree.

  • sequence_engine (SequenceEngine | None) – Inherited owning engine and its live namespace; None while detached.

Keyword Parameters:

parent (QObject | None) – Optional Qt parent object.

Examples

With an instance named run_parallel in the sequence, use the QtConsole to inspect or edit it before running. Substitute your instance name if different; result data reflects completed steps:

run_parallel.comment = "Independent measurements"
run_parallel.instance_name
execute(sub_steps: list[Callable[[], None]]) → None[source]

Execute child callables concurrently and block until all complete.

execute_sequence(sub_steps: list[Callable[[], None]]) → None[source]

Implement the standard sequence-container execution contract.

generate_action_code(indent: int, sub_steps: list, render_sub_step: Callable) → list[str][source]

Emit one helper per child and execute those helpers concurrently.

property name: str

Return the human-readable plugin name.