profit.run.command
Command Worker
The default Worker to run an executable simulation. The Preprocessor allows for a customized preparation of the environment for the simulation. The output of the simulation is retrieved by a Postprocessor.
CommandWorker: run an executable simulation
Preprocessor: new Component to prepare the environment for the simulation * TemplatePreprocessor: fill a directory according to a template directory
Postprocessor: new Component to retrieve the simulation output * JSONPostprocessor: read a simple JSON * NumpytxtPostprocessor: read a CSV/TSV (using numpy) * HDF5Postprocessor: read a simple HDF5
Module Contents
Classes
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Preprocessor which substitutes the variables with a given template |
|
Helper class that provides a standard way to create an ABC using |
Functions
|
Postprocessor to read output from a JSON file |
|
Postprocessor to read output from a tabular text file (e.g. csv, tsv) with numpy |
|
Postprocessor to read output from a HDF5 file |
- class profit.run.command.CommandWorker(run_id: int, *, pre='template', post='numpytxt', command='./simulation', stdout='stdout', stderr=None, **kwargs)[source]
Bases:
profit.run.worker.Worker
Helper class that provides a standard way to create an ABC using inheritance.
- class profit.run.command.Preprocessor(run_dir: str, *, clean=True, logger_parent=None)[source]
Bases:
profit.run.worker.Component
Helper class that provides a standard way to create an ABC using inheritance.
- class profit.run.command.TemplatePreprocessor(run_dir: str, *, clean=True, path='template', param_files=None, logger_parent=None)[source]
Bases:
Preprocessor
Preprocessor which substitutes the variables with a given template
copies the given template directory to the target run directory
searches all files for variables templates of the form {name} and replaces them with their values
for file formats which use curly braces (e.g. json) the template identifier is {{name}}
substitution can be restricted to certain files by specifying param_files, None means no restriction
relative symbolic links are converted to absolute symbolic links on copying
linked files are ignored with param_files = None, but if specified explicitly the link target is copied to the run directory and then substituted
- property template_path
- fill_run_dir_single(params, template_dir, run_dir_single, param_files=None, overwrite=False, ignore_path_exists=False)[source]
- static convert_relative_symlinks(template_dir, out_dir)[source]
When copying the template directory to the single run directories, relative paths in symbolic links are converted to absolute paths.
- fill_template(out_dir, params, param_files=None)[source]
- Parameters:
param_files (list) – a list of filenames which are to be substituted or None for all
- class profit.run.command.Postprocessor(*, logger_parent: logging.Logger = None)[source]
Bases:
profit.run.worker.Component
Helper class that provides a standard way to create an ABC using inheritance.
- profit.run.command.JSONPostprocessor(self, data)[source]
Postprocessor to read output from a JSON file
variables are assumed to be stored with the correct key and able to be converted immediately
not extensively tested
- profit.run.command.NumpytxtPostprocessor(self, data)[source]
Postprocessor to read output from a tabular text file (e.g. csv, tsv) with numpy
genfromtxt
the data is assumed to be row oriented
vector variables are spread across the row and have to be in the right order, only the name of the variable should be specified once in
names
names
which are not specified as output variables are ignoredadditional options are passed directly to ``numpy.genfromtxt()`