mlmc.sampling_pool.OneProcessPool

class mlmc.sampling_pool.OneProcessPool(work_dir=None, debug=False)[source]

Sampling pool implementation that executes all samples sequentially in a single process. Used primarily for debugging or lightweight simulations.

__init__(work_dir=None, debug=False)[source]

Initialize the one-process pool.

Parameters

work_dirstr, optional

Working directory for storing sample outputs.

debugbool, default=False

If True, disables moving/removing files after successful execution.

Methods

__init__([work_dir, debug])

Initialize the one-process pool.

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 all completed (successful and failed) samples.

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)

Return False, indicating that no samples are stored permanently.

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)

Execute a single sample synchronously (in the current process).

Attributes

FAILED_DIR

N_SUCCESSFUL

SEVERAL_SUCCESSFUL_DIR