hepi.run.run
Classes
Abstract class that is similar to a dictionary but with fixed keys. |
|
Module Contents
- class hepi.run.run.RunParam(skip=False, in_file=None, out_file=None, execute=None, name=None)[source]
Bases:
hepi.util.DictDataAbstract class that is similar to a dictionary but with fixed keys.
- Parameters:
skip (bool)
in_file (str)
out_file (str)
execute (str)
name (str)
- class hepi.run.run.Runner(path, in_dir=None, out_dir=None, pre=None)[source]
- Parameters:
path (str)
in_dir (str)
out_dir (str)
- _prepare(p, skip=False, assume_valid=False, **kwargs)[source]
- Parameters:
p (hepi.input.Input)
- Return type:
- _check_input(param, **kwargs)[source]
- Parameters:
param (hepi.input.Input)
- Return type:
bool
- _prepare_all(params, skip=True, n_jobs=None, **kwargs)[source]
Prepares all parameters for execution.
- Parameters:
params (List[
hepi.Input]) – List of input parameters.skip (bool, optional) – If True, the runner will check if the output file already exists and skip the execution if it does. Defaults to True.
n_jobs (int) – Number of parallel jobs. If None, use all available cores.
- Return type:
List[RunParam]
- run(params, skip=True, parse=True, parallel=True, sleep=0, run=True, ignore_error=False, n_jobs=None, **kwargs)[source]
Run the passed list of parameters.
- Parameters:
params (
listofhepi.Input) – All parameters that should be executed/queued.skip (bool) – True means stored runs will be skipped. Else the are overwritten.
parse (bool) – Parse the results. This is not the prefered cluster/parallel mode, as there the function only queues the job.
parallel (bool) – Run jobs in parallel.
sleep (int) – Sleep seconds after starting job.
run (bool) – Actually start/queue runner.
ignore_error (bool) – Continue instead of raising Exceptions. Also ignores hash collisions.
n_jobs (int) – Number of parallel jobs. If None, use all available cores.
- Returns:
combined dataframe of results and parameters. The dataframe is empty if parse is set to False.
- Return type:
pd.DataFrame
- _run(rps, wait=True, parallel=True, sleep=0, n_jobs=None, **kwargs)[source]
Runs Runner per
RunParams.- Parameters:
rps (
listofRunParams) – Extended run parameters.bar (bool) – Enable info bar.
wait (bool) – Wait for parallel runs to finish.
sleep (int) – Sleep seconds after starting subprocess.
parallel (bool) – Run jobs in parallel.
n_jobs (int) – Number of parallel jobs. If None, use all available cores.
- Returns:
return codes from jobs if no_parse is False.
- Return type:
listof int
- _is_valid(file, p, d, **kwargs)[source]
Verifies that a file is a complete output.
- Parameters:
file (str) – File path to be parsed.
p (
hepi.Input) – Onput parameters.d (
dict) – Param dictionary.
- Returns:
True if file could be parsed.
- Return type:
bool
- parse(outputs, n_jobs=None)[source]
Parses Resummino output files and returns List of Results.
- Args:
outputs (
listof str): List of the filenames to be parsed.
n_jobs (int): Number of parallel jobs. If None, use all available cores.
- Returns:
listofhepi.resummino.result.ResumminoResult
- Parameters:
outputs (List[str])
- Return type:
List[hepi.results.Result]
- _parse_file(file)[source]
Extracts results from an output file.
- Parameters:
file (str) – File path to be parsed.
- Returns:
If a value is not found in the file None is used.
- Return type:
Result
- set_path(p)[source]
Set the path to the Runner folder containing the binary in ‘./bin’ or ‘./build/bin’.
- Parameters:
p (str) – new path.
- set_input_dir(indir)[source]
Sets the input directory.
- Parameters:
indir (str) – new input directory.