hepi.run

Module Contents

Classes

RunParam

Abstract class that is similar to a dictionary but with fixed keys.

Runner

class hepi.run.RunParam(skip: bool = False, in_file: str = None, out_file: str = None, execute: str = None, name: str = None)[source]

Bases: hepi.util.DictData

Abstract class that is similar to a dictionary but with fixed keys.

class hepi.run.Runner(path: str, in_dir: str = None, out_dir: str = None, pre=None)[source]
orders(self) List[hepi.input.Order][source]

List of supported Orders in this runner.

get_name(self) str[source]

Returns the name of the runner.

get_version(self) str[source]
_sub_run(self, coms: List[str]) str[source]
_check_path(self) bool[source]

Checks if the passed path is valid.

_prepare(self, p: hepi.input.Input, **kwargs) RunParam[source]
_check_input(self, param: hepi.input.Input, **kwargs) bool[source]
_prepare_all(self, params: List[hepi.input.Input], skip=True, **kwargs) List[RunParam][source]
run(self, params: List[hepi.input.Input], skip=True, parse=True, parallel=True, sleep=0, run=True, **kwargs)[source]

Run the passed list of parameters.

Args:

params (list of hepi.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.

Returns:

pd.DataFrame : combined dataframe of results and parameters. The dataframe is empty if parse is set to False.

_run(self, rps: List[RunParam], wait=True, parallel=True, sleep=0, **kwargs)[source]

Runs Runner per RunParams.

Parameters
  • rps (list of RunParams) – 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.

Returns

return codes from jobs if no_parse is False.

Return type

list of int

_is_valid(self, file: str, p: hepi.input.Input, d) bool[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(self, outputs: List[str]) List[hepi.results.Result][source]

Parses Resummino output files and returns List of Results.

Parameters

outputs (list of str) – List of the filenames to be parsed.

Returns

list of hepi.resummino.result.ResumminoResult

_parse_file(self, file: str) hepi.results.Result[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

get_path(self) str[source]

Get the Runner path.

Returns

current Runner path.

Return type

str

get_input_dir(self) str[source]

Get the input directory.

Returns

in_dir

Return type

str

get_output_dir(self) str[source]

Get the input directory.

Returns

out_dir

Return type

str

get_pre(self) str[source]

Gets the command prefix.

Returns

pre

Return type

str

set_path(self, p: str)[source]

Set the path to the Runner folder containing the binary in ‘./bin’ or ‘./build/bin’.

Parameters

p (str) – new path.

set_input_dir(self, indir: str)[source]

Sets the input directory.

Parameters

indir (str) – new input directory.

set_output_dir(self, outdir: str, create: bool = True)[source]

Sets the output directory.

Parameters

outdir (str) – new output directory. create (bool): create directory if not existing.

set_pre(self, ppre: str)[source]

Sets the command prefix.

Parameters

ppre (str) – new command prefix.