embedl_hub.core package#
Public API for the Embedl Hub core package.
Subpackages#
embedl_hub.core.compile— Compiler components and results.embedl_hub.core.component— Component base classes and outputs.embedl_hub.core.device— Device abstraction and management.embedl_hub.core.invoke— Invocation components.embedl_hub.core.profile— Profiler components and results.
Top-level re-exports#
HubContext— Execution context for component runs.hub_run()— Decorator for tracking plain functions as Hub runs.RunType— Public enum for standard run types.LocalPath,RemotePath— Path type aliases.
- class embedl_hub.core.HubContext(project_name: str, artifact_base_dir: Path | None = None, devices: Sequence[Device] | None = None, download_artifacts: bool = False, auto_connect: bool = True, log_remote_artifacts: bool = True)[source]#
Bases:
objectContext for component execution.
- artifact_base_dir: Path#
- property artifact_dir: Path#
Get the local artifact directory for the current component run.
- Raises:
RuntimeError – If no artifact directory has been set. This typically means the property is accessed outside of a component dispatch.
- auto_connect: bool#
- download_artifacts: bool#
- property is_active: bool#
Whether this context has been entered and is currently active.
- property project_dir: Path#
Get the project-scoped artifact directory.
Returns
artifact_base_dir / project_name. Run subdirectories are created beneath this path.
- project_name: str#
- property run_log: RunLog | None#
The
RunLogfor the currently active run, orNoneif no run is active or there is no tracking client.Shorthand for
ctx.client.current_run_log. Return this from ahub_run()-decorated function to enable automatic parent-run linking in downstream calls.
- set_tags(**tags: str) None[source]#
Set tags that will be applied to all subsequent runs.
Replaces any previously set tags. Each keyword argument becomes a tag with the argument name as the tag name and its value as the tag value.
Example:
ctx.set_tags(model="resnet50", dataset="imagenet")
- Parameters:
tags – Arbitrary keyword arguments where each key is a tag name and each value is a tag value (both
str).- Raises:
TypeError – If any value is not a string.
- property tags: dict[str, str]#
Get the current tags set on this context (read-only copy).
- embedl_hub.core.LocalPath#
alias of
Path
- embedl_hub.core.RemotePath#
alias of
PurePosixPath
- class embedl_hub.core.RunType(value)[source]#
Bases:
Enum- COMPILE = 'COMPILE'#
- CUSTOM = 'CUSTOM'#
- EVAL = 'EVAL'#
- GRAPH = 'GRAPH'#
- INFERENCE = 'INFERENCE'#
- PROFILE = 'PROFILE'#
- embedl_hub.core.hub_run(run_type: RunType | str, *, name: str | None = None) Callable[source]#
Decorator that wraps a plain function as a tracked Hub run.
Provides the same artifact-directory setup, tracking lifecycle, remote-artifact download, and
run.yamlsaving as a fullComponent, without requiring a class definition or provider registration. Device narrowing is not performed — the function receives the fulldevicesmapping as supplied by the caller.The decorated function must accept
ctx: HubContextas its first positional parameter and must be called inside an activewith ctx:block.Usage:
@hub_run("analyse") def analyse(ctx: HubContext, data: pd.DataFrame, *, threshold=0.5): ctx.client.log_param("threshold", str(threshold)) result = run_model(data, threshold) ctx.client.log_metric("accuracy", result.accuracy) return result with HubContext(project_name="my-project") as ctx: output = analyse(ctx, data, threshold=0.8)
Parent run linking is automatic when a
ComponentOutputcarrying arun_logis passed as an argument.- Parameters:
run_type – The run type. Pass a
RunTypemember or a plain string label (e.g."analyse"); strings are automatically mapped toRunType.CUSTOM.name – Display name logged to the Hub. Defaults to the function’s
__name__.
- Returns:
A decorator that wraps the target function.
- Raises:
TypeError – If the decorated function does not have
ctxas its first parameter.RuntimeError – When the wrapped function is called outside an active
HubContext(i.e. beforewith ctx:is entered).
Subpackages#
- embedl_hub.core.compile package
- embedl_hub.core.component package
- embedl_hub.core.device package
- Re-exports
CommandResultCommandRunnerDeviceDevice.artifact_base_dirDevice.artifact_dirDevice.connect()Device.create_device_log()Device.download_artifact_dir()Device.get_provider_config()Device.is_activeDevice.last_download_dirDevice.nameDevice.provider_configDevice.provider_config_overridesDevice.provider_typeDevice.runnerDevice.spec
DeviceManagerDeviceSpecEmbedlONNXRuntimeConfigProviderConfigSSHCommandRunnerSSHConfigSSHConnectionErrorTrtexecConfig
- embedl_hub.core.invoke package
- embedl_hub.core.profile package