pacman.executor package

Module contents

class pacman.executor.AlgorithmMetadataXmlReader(xml_paths)[source]

Bases: object

Converts an XML file into algorithm data.

Parameters:xml_paths (list(str)) – paths to extra metadata files
Returns:the algorithm data objects which represent all the algorithm’s inputs and outputs
Return type:dict(str, AbstractAlgorithm)
class pacman.executor.PACMANAlgorithmExecutor(algorithms, optional_algorithms, inputs, required_outputs, tokens, required_output_tokens, xml_paths=None, packages=None, do_timings=True, print_timings=False, do_immediate_injection=True, do_post_run_injection=False, inject_inputs=True, do_direct_injection=True, use_unscanned_annotated_algorithms=True, provenance_path=None, provenance_name=None)[source]

Bases: object

An executor of PACMAN algorithms where the order is deduced from the input and outputs of the algorithm using an XML description of the algorithm.

  • algorithms (list(str)) – A list of algorithms that must all be run
  • optional_algorithms (list(str)) – A list of algorithms that must be run if their inputs are available
  • inputs (dict(str, ..)) – A dict of input type to value
  • required_outputs (list(str)) – A list of output types that must be generated
  • tokens (list(str)) – A list of tokens that should be considered to have been generated
  • required_output_tokens (list(str)) – A list of tokens that should be generated by the end of the run
  • xml_paths (list(str)) – An optional list of paths to XML files containing algorithm descriptions; if not specified, only detected algorithms will be used (or else those found in packages)
  • packages (list(module)) – An optional list of packages to scan for decorated algorithms; if not specified, only detected algorithms will be used (or else those specified in packages
  • do_timings (bool) – True if timing information should be captured for each algorithm, False otherwise
  • print_timings (bool) – True if timing information should be printed after each algorithm, False otherwise
  • do_immediate_injection (bool) – Perform injection with objects as they are created; can result in multiple calls to the same inject-annotated methods
  • do_post_run_injection (bool) – Perform injection at the end of the run. This will only set the last object of any type created.
  • inject_inputs (bool) – True if inputs should be injected; only active if one of do_immediate_injection or do_post_run_injection is True. These variables define when the injection of inputs is done; if immediate injection is True, injection of inputs is done at the start of the run, otherwise it is done at the end.
  • do_direct_injection (bool) – True if direct injection into methods should be supported. This will allow any of the inputs or generated outputs to be injected into a method
  • use_unscanned_annotated_algorithms (bool) – True if algorithms that have been detected outside of the packages argument specified above should be used
  • provenance_path (str) – Path to file to append full provenance data to If None no provenance is written

PacmanConfigurationException – if the configuration cannot be compiled into an execution plan


Executes the algorithms

Return type:None

Get all of the tokens that have completed as part of this execution

Returns:A list of tokens
Return type:list(str)

Get an item from the outputs of the execution

Parameters:item_type (str) – the item from the internal type mapping to be returned
Returns:the returned item

Get all the outputs from a execution

Returns:dictionary of types as keys and values.
Return type:dict(str, ..)