“System” Module¶
A portal to load/run tasks of PanPython.
- class panpython.system.System(dump_path, pandat='', time_limit_in_min=15.0)[source]¶
Bases:
object
- Parameters:
dump_path (str) – the path where task result is saved
pandat (str, default='') – a full path of pandat.exe
time_limit_in_min (str, default=15.0) – time limit (minutes) for each pandat calculation
Note
Initialize “System” instance with dump path and full path of Pandat.exe, and time limit (minutes) of each Pandat calculation. Full path of Pandat.exe is necessary only when Pandat calculations are performed, while this path can be left empty when doing post-processing. Time limit of Pandat calculation is necessary for discarding abnormal calculations.
Examples
>>> import os >>> from panpython.system import System >>> from panpython.task.htc import HtcMesh >>> pandat = "YOUR_PATH_TO_PANDAT_EXE/Pandat.exe" >>> dump_path = "./output/" >>> batch_file = "./template_batchfile.pbfx" >>> config_file = "./Configuration.JSON" >>> >>> m_system = System(pandat=pandat, dump_path=dump_path) # initialize system >>> m_system.add_task(task_definition=HtcMesh(batch_file=batch_file, config_file=config_file, thread_num=1)) # add task >>> m_system.run() # run task
- add_task(task_instance)[source]¶
Add task instance to “System”
- Parameters:
task_instance (object) – A task instance
- run() bool [source]¶
Run all added tasks in “System”
- Returns:
True if all task is success, False is any task failed
- Return type:
bool
- property system_args¶
arguments of the calculation
- panpython.system.run_all_batchfiles(pandat_exe: str, path_to_folder: str, save_console_output: bool = True, show_progress: bool = True, time_limit_in_min: float = 5.0, include_subfolders: bool = False, n_process: int = 1, save_table_as_dat: bool = True, append_batchname_to_tablename: bool = True)[source]¶
Run all batchfiles in a given folder
- Parameters:
pandat_exe (str) – Full path of Pandat executable
path_to_folder (str) – Full path to the target folder
save_console_output (bool, optional) – Optionally save console output. Defaults to True.
show_progress (bool, optional) – Optionally print the progress of the calculations on screen. Defaults to True.
time_limit_in_min (float, optional) – Time limit for each simulation. Defaults to 5.0.
include_subfolders (bool, optional) – Optionally include batchfiles in subfolders. Defaults to False.
n_process (int, optional) – Number of parallel threads to use. Defaults to 1.
save_table_as_dat (bool, optional) – Save the table in the batchfiles as *.dat file. Defaults to True
append_batchname_to_tablename (bool, optional) – Rename the table by appending the batchfile name. Defaults to True