nexuml.tracking.logger¶
nexuml.tracking.logger
¶
Logger factory for NexuML experiment tracking.
get_temp_artifact_root
¶
get_temp_artifact_root() -> Path
Return the directory used for temporary artifact staging.
staged_artifact_path
¶
staged_artifact_path(
artifact_name: str, *, prefix: str = "nexuml_artifact_"
) -> Iterator[Path]
Yield a temporary filesystem path for building an artifact before logging it.
create_loggers
¶
create_loggers(
logging_spec: "LoggingSpec | None",
run_name: str | None = None,
) -> list[Any]
Build a list of Lightning loggers from a LoggingSpec.
Returns an empty list (disables logging) if spec is None. Each backend is imported lazily so missing optional deps don't crash the import.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logging_spec
|
'LoggingSpec | None'
|
LoggingSpec instance or None. |
required |
run_name
|
str | None
|
Override run name; falls back to logging_spec.run_name. |
None
|
Returns:
| Type | Description |
|---|---|
list[Any]
|
List of Lightning logger instances ready for Trainer(logger=...). |
iter_loggers
¶
iter_loggers(logger_obj: Any) -> list[Any]
Normalize Lightning logger containers into a flat list.
Returns:
| Type | Description |
|---|---|
list[Any]
|
Flat list of non-None logger instances. |
log_artifact
¶
log_artifact(
logger_obj: Any,
source_path: str | Path,
artifact_path: str | None = None,
) -> None
Log or copy a file artifact to all configured logger backends.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If source_path does not exist. |
log_text_artifact
¶
log_text_artifact(
logger_obj: Any,
text: str,
artifact_name: str,
artifact_path: str | None = None,
) -> None
Write text content to a temporary file and log it as an artifact.
log_image
¶
log_image(
logger_obj: Any,
tag: str,
image: Any,
step: int | None = None,
artifact_path: str | None = None,
) -> None
Log an image to all configured logger backends.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logger_obj
|
Any
|
Lightning logger or list of loggers. |
required |
tag
|
str
|
Name/tag for the image (e.g. |
required |
image
|
Any
|
Image data — numpy array (HWC, uint8 or float [0,1]), PIL Image, or torch tensor (CHW, uint8 or float [0,1]). |
required |
step
|
int | None
|
Global step for time-series backends (TensorBoard). |
None
|
artifact_path
|
str | None
|
Optional subdirectory within the run's artifact store (MLflow / file-based backends only). |
None
|
print_service_info
¶
print_service_info(
trainer_loggers: list[Any],
scenario_name: str,
log_dir: str | Path = ".experiments",
logging_spec: Any | None = None,
tuning_spec: Any | None = None,
data_backend: str | None = None,
training_backend: str | None = None,
) -> None
Print actionable commands for all active monitoring services.
Called once at the start of training so the user knows how to inspect metrics, tune hyperparameters, etc.