mlmc.sampling_pool.SamplingPool
- class mlmc.sampling_pool.SamplingPool(work_dir=None, debug=False)[source]
Abstract base class defining the runtime environment for sample simulations. It manages sample execution across different backends (single process, multiprocessing, PBS, etc.).
- __init__(work_dir=None, debug=False)[source]
Initialize the sampling pool environment.
- Parameters:
work_dir (
Optional[str]) – Path to the working directory where outputs are stored.debug (
bool) – If True, keep sample directories for debugging.
Methods
__init__([work_dir, debug])Initialize the sampling pool environment.
calculate_sample(sample_id, level_sim[, ...])Execute a single simulation sample.
change_to_sample_directory(work_dir, path)Create and switch to the sample-specific directory.
compute_seed(sample_id)Compute a deterministic seed for a given sample ID.
copy_sim_files(files, sample_dir)Copy shared simulation files to the sample directory.
get_finished()Retrieve finished sample results.
handle_sim_files(work_dir, sample_id, level_sim)Prepare the sample workspace (create directory, copy common files, set cwd).
have_permanent_samples(sample_ids)Inform the pool about samples that have been scheduled but not yet finished.
move_dir(sample_id, sample_workspace, ...)Move a sample directory to another location (e.g., failed or successful).
move_failed_rm(sample_id, level_sim, ...)Move failed sample directories and remove originals.
move_successful_rm(sample_id, level_sim, ...)Move successful sample directories and remove originals.
remove_sample_dir(sample_id, ...)Remove the directory for a completed or failed sample.
schedule_sample(sample_id, level_sim)Schedule a simulation sample for execution.
Attributes
FAILED_DIRN_SUCCESSFULSEVERAL_SUCCESSFUL_DIR