pacman.executor.algorithm_classes package

Submodules

pacman.executor.algorithm_classes.abstract_algorithm module

class pacman.executor.algorithm_classes.abstract_algorithm.AbstractAlgorithm(algorithm_id, required_inputs, optional_inputs, outputs, required_input_tokens, optional_input_tokens, generated_output_tokens)[source]

Bases: object

Represents the metadata for an algorithm.

Parameters:
  • algorithm_id (str) – The unique ID of the algorithm
  • required_inputs (list(AbstractInput)) – The inputs required by the algorithm
  • optional_inputs (list(AbstractInput)) – The optional inputs for the algorithm, which will be provided when available
  • outputs (list(Output)) – The output types of the algorithm
  • required_input_tokens (list(Token)) – Tokens required to have been generated before this algorithm can start
  • optional_input_tokens (list(Token)) – Tokens required to have been generated before this algorithm can start if and only if at least one algorithm generates the token
  • generated_output_tokens (list(Token)) – Tokens generated by this algorithm
algorithm_id

The ID for this algorithm

call(inputs)[source]

Call the algorithm with the given inputs and return the outputs

Parameters:inputs – A dict of input type -> value
Returns:A dict of output type -> value
generated_output_tokens

The generated output tokens of the algorithm

optional_input_tokens

The optional input tokens of the algorithm

optional_inputs

The optional inputs of the algorithm

outputs

The outputs of the algorithm

required_input_tokens

The required input tokens of the algorithm

required_inputs

The required inputs of the algorithm

write_provenance_header(provenance_file)[source]

Writes the header info for this algorithm So things like name, module, class, function and command_line_arguments

But not anything about input and outputs as this is done elsewhere :param provenance_file: File to write to :type provenance_file: file

pacman.executor.algorithm_classes.abstract_python_algorithm module

class pacman.executor.algorithm_classes.abstract_python_algorithm.AbstractPythonAlgorithm(algorithm_id, required_inputs, optional_inputs, outputs, required_input_tokens, optional_input_tokens, generated_output_tokens, python_module)[source]

Bases: pacman.executor.algorithm_classes.abstract_algorithm.AbstractAlgorithm

An algorithm written in Python.

Parameters:python_module – The module containing the python code to execute
call(inputs)[source]

Call the algorithm with the given inputs and return the outputs

Parameters:inputs – A dict of input type -> value
Returns:A dict of output type -> value
call_python(inputs)[source]

Call the algorithm

Parameters:inputs – A dict of parameter name -> value
Returns:The result of calling the python algorithm

pacman.executor.algorithm_classes.external_algorithm module

class pacman.executor.algorithm_classes.external_algorithm.ExternalAlgorithm(algorithm_id, required_inputs, optional_inputs, outputs, required_input_tokens, optional_input_tokens, generated_output_tokens, command_line_arguments)[source]

Bases: pacman.executor.algorithm_classes.abstract_algorithm.AbstractAlgorithm

An algorithm which is external to the SpiNNaker software, or rather its wrapper into PACMAN.

call(inputs)[source]

Call the algorithm with the given inputs and return the outputs

Parameters:inputs – A dict of input type -> value
Returns:A dict of output type -> value
write_provenance_header(provenance_file)[source]

Writes the header info for this algorithm So things like name, module, class, function and command_line_arguments

But not anything about input and outputs as this is done elsewhere :param provenance_file: File to write to :type provenance_file: file

pacman.executor.algorithm_classes.python_class_algorithm module

class pacman.executor.algorithm_classes.python_class_algorithm.PythonClassAlgorithm(algorithm_id, required_inputs, optional_inputs, outputs, required_input_tokens, optional_input_tokens, generated_output_tokens, python_module, python_class, python_method=None)[source]

Bases: pacman.executor.algorithm_classes.abstract_python_algorithm.AbstractPythonAlgorithm

An algorithm that is a class.

Parameters:
  • python_class – The class of the algorithm
  • python_method – The method of the algorithm, or None if the class is callable
call_python(inputs)[source]

Call the algorithm

Parameters:inputs – A dict of parameter name -> value
Returns:The result of calling the python algorithm
write_provenance_header(provenance_file)[source]

Writes the header info for this algorithm So things like name, module, class, function and command_line_arguments

But not anything about input and outputs as this is done elsewhere :param provenance_file: File to write to :type provenance_file: file

pacman.executor.algorithm_classes.python_function_algorithm module

class pacman.executor.algorithm_classes.python_function_algorithm.PythonFunctionAlgorithm(algorithm_id, required_inputs, optional_inputs, outputs, required_input_tokens, optional_input_tokens, generated_output_tokens, python_module, python_function)[source]

Bases: pacman.executor.algorithm_classes.abstract_python_algorithm.AbstractPythonAlgorithm

An algorithm that is a function.

Parameters:python_function – The name of the function to call
call_python(inputs)[source]

Call the algorithm

Parameters:inputs – A dict of parameter name -> value
Returns:The result of calling the python algorithm
write_provenance_header(provenance_file)[source]

Writes the header info for this algorithm So things like name, module, class, function and command_line_arguments

But not anything about input and outputs as this is done elsewhere :param provenance_file: File to write to :type provenance_file: file

Module contents

class pacman.executor.algorithm_classes.AbstractAlgorithm(algorithm_id, required_inputs, optional_inputs, outputs, required_input_tokens, optional_input_tokens, generated_output_tokens)[source]

Bases: object

Represents the metadata for an algorithm.

Parameters:
  • algorithm_id (str) – The unique ID of the algorithm
  • required_inputs (list(AbstractInput)) – The inputs required by the algorithm
  • optional_inputs (list(AbstractInput)) – The optional inputs for the algorithm, which will be provided when available
  • outputs (list(Output)) – The output types of the algorithm
  • required_input_tokens (list(Token)) – Tokens required to have been generated before this algorithm can start
  • optional_input_tokens (list(Token)) – Tokens required to have been generated before this algorithm can start if and only if at least one algorithm generates the token
  • generated_output_tokens (list(Token)) – Tokens generated by this algorithm
algorithm_id

The ID for this algorithm

call(inputs)[source]

Call the algorithm with the given inputs and return the outputs

Parameters:inputs – A dict of input type -> value
Returns:A dict of output type -> value
generated_output_tokens

The generated output tokens of the algorithm

optional_input_tokens

The optional input tokens of the algorithm

optional_inputs

The optional inputs of the algorithm

outputs

The outputs of the algorithm

required_input_tokens

The required input tokens of the algorithm

required_inputs

The required inputs of the algorithm

write_provenance_header(provenance_file)[source]

Writes the header info for this algorithm So things like name, module, class, function and command_line_arguments

But not anything about input and outputs as this is done elsewhere :param provenance_file: File to write to :type provenance_file: file

class pacman.executor.algorithm_classes.AbstractPythonAlgorithm(algorithm_id, required_inputs, optional_inputs, outputs, required_input_tokens, optional_input_tokens, generated_output_tokens, python_module)[source]

Bases: pacman.executor.algorithm_classes.abstract_algorithm.AbstractAlgorithm

An algorithm written in Python.

Parameters:python_module – The module containing the python code to execute
call(inputs)[source]

Call the algorithm with the given inputs and return the outputs

Parameters:inputs – A dict of input type -> value
Returns:A dict of output type -> value
call_python(inputs)[source]

Call the algorithm

Parameters:inputs – A dict of parameter name -> value
Returns:The result of calling the python algorithm
class pacman.executor.algorithm_classes.ExternalAlgorithm(algorithm_id, required_inputs, optional_inputs, outputs, required_input_tokens, optional_input_tokens, generated_output_tokens, command_line_arguments)[source]

Bases: pacman.executor.algorithm_classes.abstract_algorithm.AbstractAlgorithm

An algorithm which is external to the SpiNNaker software, or rather its wrapper into PACMAN.

call(inputs)[source]

Call the algorithm with the given inputs and return the outputs

Parameters:inputs – A dict of input type -> value
Returns:A dict of output type -> value
write_provenance_header(provenance_file)[source]

Writes the header info for this algorithm So things like name, module, class, function and command_line_arguments

But not anything about input and outputs as this is done elsewhere :param provenance_file: File to write to :type provenance_file: file

class pacman.executor.algorithm_classes.PythonClassAlgorithm(algorithm_id, required_inputs, optional_inputs, outputs, required_input_tokens, optional_input_tokens, generated_output_tokens, python_module, python_class, python_method=None)[source]

Bases: pacman.executor.algorithm_classes.abstract_python_algorithm.AbstractPythonAlgorithm

An algorithm that is a class.

Parameters:
  • python_class – The class of the algorithm
  • python_method – The method of the algorithm, or None if the class is callable
call_python(inputs)[source]

Call the algorithm

Parameters:inputs – A dict of parameter name -> value
Returns:The result of calling the python algorithm
write_provenance_header(provenance_file)[source]

Writes the header info for this algorithm So things like name, module, class, function and command_line_arguments

But not anything about input and outputs as this is done elsewhere :param provenance_file: File to write to :type provenance_file: file

class pacman.executor.algorithm_classes.PythonFunctionAlgorithm(algorithm_id, required_inputs, optional_inputs, outputs, required_input_tokens, optional_input_tokens, generated_output_tokens, python_module, python_function)[source]

Bases: pacman.executor.algorithm_classes.abstract_python_algorithm.AbstractPythonAlgorithm

An algorithm that is a function.

Parameters:python_function – The name of the function to call
call_python(inputs)[source]

Call the algorithm

Parameters:inputs – A dict of parameter name -> value
Returns:The result of calling the python algorithm
write_provenance_header(provenance_file)[source]

Writes the header info for this algorithm So things like name, module, class, function and command_line_arguments

But not anything about input and outputs as this is done elsewhere :param provenance_file: File to write to :type provenance_file: file