mlmc.sampling_pool_pbs.SamplingPoolPBS
- class mlmc.sampling_pool_pbs.SamplingPoolPBS(work_dir, debug=False)[source]
Sampling pool PBS (Portable batch system) runtime environment
- __init__(work_dir, debug=False)[source]
- Parameters:
work_dir – Path to working directory
debug – bool, if True keep sample directories it is the strongest parameter so it overshadows ‘clean’ param
Methods
__init__(work_dir[, debug])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.
collect_data()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.
delete_pbs_id_file(file_path)Delete jobId_pbsId file - it indicates finished job :type file_path: :param file_path: str :return: None
execute()Execute pbs script :return: None
get_finished()Get results :return:
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)List of unfinished sample ids, the corresponding samples are collecting in next get_finished() call
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.
pbs_common_setting(**kwargs)Values for common header of script :type kwargs: :param kwargs: Dict[ env_setting: environmental setting - load modules, install packages, ... n_nodes: number of used nodes, n_cores: number of cores a node, mem: used memory a job, queue: used queue on the server,.
remove_sample_dir(sample_id, ...)Remove the directory for a completed or failed sample.
schedule_sample(sample_id, level_sim)Add sample to current PBS package :type sample_id: :param sample_id: unique sample id from Sampler :type level_sim: :param level_sim: LevelSimulation instance :return: None
serialize_level_sim(level_sim)Pickle LevelSimulation instance :type level_sim:
LevelSimulation:param level_sim: LevelSimulation :return: Nonewrite_script(content, job_file)Create :type content: :param content: script content :type job_file: :param job_file: job file path :return: None
Attributes
FAILED_DIRJOBJOBS_DIRLEVEL_SIM_CONFIGN_SUCCESSFULOUTPUT_DIRQSTAT_FAILED_MAX_NQSUB_FAILED_MAX_NSEVERAL_SUCCESSFUL_DIR