mlrun.hub#
- class mlrun.hub.step.HubStep(name: str, version: str, class_name: str, default_handler: str, description: str | None = None, categories: list | None = None, requirements: list | None = None, local_path: Path | None = None, filename: str | None = None, example: str | None = None, url: str | None = None, **kwargs)[source]#
Bases:
HubAsset- ASSET_TYPE: ClassVar[HubSourceType] = 'steps'#
- download_files(local_path: str | None = None, download_example: bool = False)[source]#
Download this step's code file.
- Parameters:
local_path -- Target directory to download the step files to. Defaults to the current working directory. This path will be used to locate the code file when importing it as a python module.
download_example -- Whether to download the example notebook if available. Defaults to False.
- mlrun.hub.step.get_hub_step(url: str, local_path: str | None = None, download_files: bool = True, include_example: bool = False) HubStep[source]#
Get a hub-step object containing metadata of the requested step.
- Parameters:
url -- Hub step url in the format "hub://[<source>/]<item-name>[:<tag>]"
local_path -- Path to target directory for the step files. Ignored when download_files is set to False. Defaults to the current working directory.
download_files -- When set to True, the step code files are downloaded
include_example -- When set to True, the example notebook will also be downloaded (ignored if download_files is False)
- Returns:
HubStep object
- class mlrun.hub.module.HubModule(name: str, version: str, kind: HubModuleType | str, description: str | None = None, categories: list | None = None, requirements: list | None = None, local_path: Path | None = None, filename: str | None = None, example: str | None = None, url: str | None = None, **kwargs)[source]#
Bases:
HubAsset- ASSET_TYPE: ClassVar[HubSourceType] = 'modules'#
- download_files(local_path: str | None = None, download_example: bool = True)[source]#
Download this hub module’s code file.
- Parameters:
local_path -- Target directory to download the module files to. Defaults to the current working directory. This path will be used to locate the code file when importing it as a module.
download_example -- Whether to download the example notebook if available. Defaults to True.
- download_module_files(local_path: str | None = None, secrets: dict | None = None)[source]#
Download this hub module’s files (code file and, if available, an example notebook) to the target directory specified by local_path (defaults to the current working directory). This path will be used later to locate the code file when importing the module.
- mlrun.hub.module.get_hub_module(url: str, download_files: bool = True, secrets: dict | None = None, local_path: str | None = None) HubModule[source]#
Get a hub-module object containing metadata of the requested module.
- Parameters:
url -- Hub module url in the format "hub://[<source>/]<item-name>[:<tag>]"
download_files -- When set to True, the module files (code file and example notebook) are downloaded
secrets -- Optional, credentials dict for DB or URL (s3, v3io, ...)
local_path -- Path to target directory for the module files. Ignored when download_files is set to False. Defaults to the current working directory.
- Returns:
HubModule object
- mlrun.hub.module.import_module(url: str, install_requirements: bool = False, secrets: dict | None = None, local_path: str | None = None)[source]#
Import a module from the hub to use directly.
- Parameters:
url -- hub module url in the format "hub://[<source>/]<item-name>[:<tag>]"
install_requirements -- when set to True, the module's requirements are installed.
secrets -- optional, credentials dict for DB or URL (s3, v3io, ...)
local_path -- Path to target directory for the module files (code and example notebook). Defaults to the current working directory.
- Returns:
the module