pacman.executor package¶
Subpackages¶
- pacman.executor.algorithm_classes package
- Submodules
- pacman.executor.algorithm_classes.abstract_algorithm module
- pacman.executor.algorithm_classes.abstract_python_algorithm module
- pacman.executor.algorithm_classes.external_algorithm module
- pacman.executor.algorithm_classes.python_class_algorithm module
- pacman.executor.algorithm_classes.python_function_algorithm module
- Module contents
- pacman.executor.algorithm_decorators package
- Submodules
- pacman.executor.algorithm_decorators.abstract_input module
- pacman.executor.algorithm_decorators.algorithm_decorator module
- pacman.executor.algorithm_decorators.all_of_input module
- pacman.executor.algorithm_decorators.one_of_input module
- pacman.executor.algorithm_decorators.output module
- pacman.executor.algorithm_decorators.single_input module
- pacman.executor.algorithm_decorators.token module
- Module contents
Submodules¶
pacman.executor.algorithm_metadata_xml_reader module¶
pacman.executor.injection_decorator module¶
-
exception
pacman.executor.injection_decorator.
InjectionException
[source]¶ Bases:
Exception
Raised when there is an error with injection.
-
pacman.executor.injection_decorator.
clear_injectables
()[source]¶ Clear the current set of injectables
-
pacman.executor.injection_decorator.
do_injection
(objects_to_inject, objects_to_inject_into=None)[source]¶ Perform the actual injection of objects.
Parameters: - objects_to_inject (dict(str)->object) – The objects to be injected as a dict of type name -> object of type
- objects_to_inject_into (list) – The objects whose classes support_injection, or None to use all instances that have been created
-
pacman.executor.injection_decorator.
inject
(type_to_inject)[source]¶ Marks a method as something to be called to inject an object of the given type. The type is just a name for the type, and should match up at some point with some generated data.
Parameters: type_to_inject – The type to be injected using this method
-
pacman.executor.injection_decorator.
inject_items
(types)[source]¶ Indicates values that need to be injected into the method
Parameters: types – A dict of method argument name to type name to be injected
-
class
pacman.executor.injection_decorator.
injection_context
(injection_dictionary)[source]¶ Bases:
object
Provides a context for injection to use with with.
Parameters: injection_dictionary – The dictionary of items to inject whilst in the context
-
pacman.executor.injection_decorator.
provide_injectables
(injectables)[source]¶ Set the objects from which values should be injected into methods
Parameters: injectables – A dict of type to value
-
pacman.executor.injection_decorator.
requires_injection
(types_required)[source]¶ Indicates that injection of the given types is required before this method is called; an Exception is raised if the types have not been injected.
Parameters: types_required (list(str)) – A list of types that must have been injected
pacman.executor.pacman_algorithm_executor module¶
-
class
pacman.executor.pacman_algorithm_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.
Parameters: - algorithms – A list of algorithms that must all be run
- optional_algorithms – A list of algorithms that must be run if their inputs are available
- inputs – A dict of input type to value
- required_outputs – A list of output types that must be generated
- tokens – A list of tokens that should be considered to have been generated
- required_output_tokens – A list of tokens that should be generated by the end of the run
- xml_paths – 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 – 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 – True if timing information should be printed after each algorithm, False otherwise
- do_immediate_injection – Perform injection with objects as they are created; can result in multiple calls to the same inject-annotated methods
- do_post_run_injection – Perform injection at the end of the run. This will only set the last object of any type created.
- inject_inputs – 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 – 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 – True if algorithms that have been detected outside of the packages argument specified above should be used
- provenance_path – Path to file to append full provenance data to If None no provenance is written
-
algorithm_timings
¶
-
get_completed_tokens
()[source]¶ Get all of the tokens that have completed as part of this execution
Returns: A list of tokens
pacman.executor.token_states module¶
Module contents¶
-
class
pacman.executor.
AlgorithmMetadataXmlReader
(xml_paths)[source]¶ Bases:
object
Converts an XML file into algorithm data.
Parameters: xml_paths – paths to extra metadata files Return type: None
-
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.
Parameters: - algorithms – A list of algorithms that must all be run
- optional_algorithms – A list of algorithms that must be run if their inputs are available
- inputs – A dict of input type to value
- required_outputs – A list of output types that must be generated
- tokens – A list of tokens that should be considered to have been generated
- required_output_tokens – A list of tokens that should be generated by the end of the run
- xml_paths – 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 – 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 – True if timing information should be printed after each algorithm, False otherwise
- do_immediate_injection – Perform injection with objects as they are created; can result in multiple calls to the same inject-annotated methods
- do_post_run_injection – Perform injection at the end of the run. This will only set the last object of any type created.
- inject_inputs – 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 – 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 – True if algorithms that have been detected outside of the packages argument specified above should be used
- provenance_path – Path to file to append full provenance data to If None no provenance is written
-
algorithm_timings
¶
-
get_completed_tokens
()[source]¶ Get all of the tokens that have completed as part of this execution
Returns: A list of tokens