Execution
module crystallize.plugins.execution
Section titled “module crystallize.plugins.execution”Execution is delegated out of Experiment into two collaborators:
- An execution plugin (e.g.,
SerialExecution,ParallelExecution, orAsyncExecution) that drives the replicate loop viarun_experiment_loop. ResultAggregator(fromcrystallize.experiments.aggregation) which collates replicate outputs, seeds, provenance, and metrics into aResult.
Experiment.run/arun selects the strategy plugin, passes in the replicate callable, and then hands the collected replicate results to ResultAggregator. Override or swap these collaborators instead of subclassing Experiment to change aggregation behavior; the legacy _aggregate_results hook is no longer part of the execution path.
Global Variables
Section titled “Global Variables”- TYPE_CHECKING
- VALID_EXECUTOR_TYPES
class SerialExecution
Section titled “class SerialExecution”Execute replicates one after another within the main process.
method SerialExecution.__init__
Section titled “method SerialExecution.__init__”__init__(progress: 'bool' = False) → Nonemethod SerialExecution.run_experiment_loop
Section titled “method SerialExecution.run_experiment_loop”run_experiment_loop( experiment: "'Experiment'", replicate_fn: 'Callable[[int], Any]') → List[Any]class ParallelExecution
Section titled “class ParallelExecution”Run SYNC replicates concurrently using ThreadPoolExecutor or ProcessPoolExecutor.
method ParallelExecution.__init__
Section titled “method ParallelExecution.__init__”__init__( max_workers: 'Optional[int]' = None, executor_type: 'str' = 'thread', progress: 'bool' = False) → Nonemethod ParallelExecution.run_experiment_loop
Section titled “method ParallelExecution.run_experiment_loop”run_experiment_loop( experiment: "'Experiment'", replicate_fn: 'Callable[[int], Any]') → List[Any]class AsyncExecution
Section titled “class AsyncExecution”Run async replicates concurrently using asyncio.gather.
method AsyncExecution.__init__
Section titled “method AsyncExecution.__init__”__init__(progress: 'bool' = False) → Nonemethod AsyncExecution.run_experiment_loop
Section titled “method AsyncExecution.run_experiment_loop”run_experiment_loop( experiment: "'Experiment'", replicate_fn: 'Callable[[int], Any]') → List[Any]