Skip to content

module_types

anom_processing.example

type_name anom_processing.example The registered name for this item type.
documentation

A very simple example module; concatenate two strings.

The purpose of this modules is to show the main elements of a [KiaraModule][kiara.modules.KiaraModule]:

  • *the (optional) configuration class*: must inherit from [KiaraModuleConfig][kiara.modules.KiaraModuleConfig], and the config class must be set as the _config_cls attribute on the KiaraModule class. Configuration values can be retrieved via the [self.get_config_value(key)][kiara.modules.KiaraModule.get_config_value] method
  • *the inputs description*: must return a dictionary, containing the input name(s) as keys, and another dictionary containing type_name information and documentation about the input data as value
  • *the outputs description*: must return a dictionary, containing the output name(s) as keys, and another dictionary containing type_name information and documentation about the output data as value
  • *the process method*: this is where the actual work gets done. Input data can be accessed via inputs.get_value_data(key), results can be set with the outputs.set_value(key, value) method

Example:

This example module can be tested on the commandline with the ``kiara run`` command:

```
kiara run core_types.example text_1="xxx" text_2="yyy"
```
Documentation for the item.
authors Information about authorship for the item.
context
tags anom_processing
labels
  • package: kiara_plugin.anom_processing
references
Generic properties of this item (description, tags, labels, references, ...).
python_class
python_class_name ExampleModule The name of the Python class.
python_module_name kiara_plugin.anom_processing.modules The name of the Python module this class lives in.
full_name kiara_plugin.anom_processing.modules.ExampleModule The full class namespace.
The python class that implements this module type.
process_src def process(self, inputs: ValueMap, outputs: ValueMap) -> None: separator = self.get_config_value("separator") text_1 = inputs.get_value_data("text_1") text_2 = inputs.get_value_data("text_2") result = text_1 + separator + text_2 outputs.set_value("text", result) The source code of the process method of the module.