caikit.runtime.utils.import_util
A generic module to help import dynamic modules
Attributes
Classes
This class acts as an aggregator between the data models of multiple |
Functions
|
Get the data model from the Caikit library of interest. This is accomplished |
|
Function to get caikit core CDM from library name |
|
Get the dynamic module of interest. |
|
Module Contents
- class caikit.runtime.utils.import_util.UnifiedDataModel[source]
This class acts as an aggregator between the data models of multiple Caikit libraries.
- _libraries
- caikit.runtime.utils.import_util.get_data_model(config: aconfig.Config = None) UnifiedDataModel[source]
Get the data model from the Caikit library of interest. This is accomplished via dynamic import on the caikit_library’s environment variable.
- NOTE: This function also has the side-effect of importing each of the
caikit_library libraries for the first time, causing their modules to be registered with the caikit.core module registry. It is a critical step in initializing the set of modules that can be loaded by this running server instance.
- Args:
config(aconfig.Config): caikit configuration
- Returns:
(module): Handle to the module after dynamic wild import
- caikit.runtime.utils.import_util._get_cdm_from_lib(lib_name: str, cdm: UnifiedDataModel)[source]
Function to get caikit core CDM from library name
- Args:
lib_name (str): Caikit core library name cdm (UnifiedDataModel): Caikit core CDM
- Returns:
cdm: UnifiedDataModel
- caikit.runtime.utils.import_util.get_dynamic_module(module_name: str, module_dir: str = None) types.ModuleType[source]
Get the dynamic module of interest.
- Args:
module_name(str): Name of the module to be dynamically imported (Optional) module_dir(str): Name of the directory from where the module is
to be dynamically imported
- Returns:
(module): Handle to the module after dynamic import