morpheus.utils.module_utils
Module utilities for Morpheus.
Functions
get_config_with_overrides (config, module_id) |
This function returns the module configuration with the overrides. |
get_module_config (module_id, builder) |
Returns the module configuration for the specified module id. |
load_module (config, builder) |
Loads a module that exists in the module registry. |
make_nested_module (module_id, namespace, ...) |
This function creates a nested module and registers it in the module registry. |
merge_dictionaries (primary_dict, secondary_dict) |
Recursively merge two dictionaries, using primary_dict as a tie-breaker. |
register_module (module_id, namespace) |
Registers a module if not exists in the module registry. |
to_period_approximation (data_df, period) |
This function converts a dataframe to a period approximation. |
verify_module_meta_fields (config) |
This function make sure the module configuration contains meta fields. |
verify_module_registration (func) |
Module availability in the module registry is verified by this function. |
Classes
ModuleLoader (module_interface, name, config) |
Class to hold the definition of a module. |
ModuleLoaderFactory (module_id, module_namespace) |
Class that acts as a simple wrapper to load a SegmentModule. |
- get_config_with_overrides(config, module_id, module_name=None, module_namespace='morpheus')[source]
This function returns the module configuration with the overrides.
- get_module_config(module_id, builder)[source]
Returns the module configuration for the specified module id.
- Parameters
- module_idstr
Unique identifier for a module in the module registry.
- buildermrc.Builder
MRC Builder object.
- Returns
- configtyping.Dict
Module configuration.
- load_module(config, builder)[source]
Loads a module that exists in the module registry.
- Parameters
- configtyping.Dict
Module configuration.
- buildermrc.Builder
MRC Builder object.
- Returns
- module
Module object.
- make_nested_module(module_id, namespace, ordered_modules_meta)[source]
This function creates a nested module and registers it in the module registry. This module unifies a chain of two or more modules into a single module.
- Parameters
- module_idstr
Unique identifier for a module in the module registry.
- namespacestr
Namespace to virtually cluster the modules.
- ordered_modules_metatyping.List[typing.Dict[str, str]]
The sequence in which the edges between the nodes are made will be determined by ordered modules meta.
- merge_dictionaries(primary_dict, secondary_dict)[source]
Recursively merge two dictionaries, using primary_dict as a tie-breaker.
Lists are treated as a special case, and all unique elements from both dictionaries are included in the final list.
- Args:
primary_dict (dict): The primary dictionary. secondary_dict (dict): The secondary dictionary.
- Returns:
dict: The merged dictionary.
- register_module(module_id, namespace)[source]
Registers a module if not exists in the module registry.
- Parameters
- module_idstr
Unique identifier for a module in the module registry.
- namespacestr
Namespace to virtually cluster the modules.
- Returns
- inner_func
Encapsulated function.
- to_period_approximation(data_df, period)[source]
This function converts a dataframe to a period approximation.
- Parameters
- data_dfDataFrameType
Input cudf/pandas dataframe.
- periodstr
Period.
- Returns
- DataFrame
Period approximation of the input cudf/pandas dataframe.
- verify_module_meta_fields(config)[source]
This function make sure the module configuration contains meta fields.
- Parameters
- configtyping.Dict
Module configuration.
- verify_module_registration(func)[source]
Module availability in the module registry is verified by this function.
- Parameters
- funcFunction that requires wrapping.
- Returns
- inner_func
Encapsulated function.