Service Bundle#
- class ServiceBundle(logger: LoggingService, metadata: MetadataService, io: IOService, utility: UtilityService, reporting: ReportingService, rerun: RerunService)[source]#
Bases:
objectBundle of services that classes can access at runtime.
This dataclass serves as a container for all services in the Brisk package, providing convenient access to logging, metadata, I/O, utility, reporting, and rerun functionality through a single object.
The ServiceBundle implements the facade pattern, simplifying access to the service architecture while maintaining loose coupling between components. It is typically created by the GlobalServiceManager and accessed through the get_services() function.
- Attributes:
- loggerlogging.LoggingService
Service for logging messages and debugging information
- metadatametadata.MetadataService
Service for storing and retrieving metadata
- ioio.IOService
Service for file I/O operations, data loading, and plot saving
- utilityutility.UtilityService
Service for utility functions and data processing
- reportingreporting.ReportingService
Service for generating reports and storing report data
- rerunrerun.RerunService
Service for managing experiment reruns and coordination
Notes
This is a dataclass, so all attributes are automatically generated as instance variables. The dataclass provides a clean interface for accessing all services without tight coupling.
Examples
>>> from brisk.services import get_services >>> from pathlib import Path >>> >>> # Get service bundle >>> services = get_services() >>> >>> # Use different services >>> services.logger.info("Starting experiment") >>> services.metadata.store("experiment_id", "exp_001") >>> >>> # Save data and plots >>> data = {"accuracy": 0.95, "precision": 0.92} >>> services.io.save_to_json(data, Path("results.json"), {}) >>> >>> # Generate report >>> services.reporting.generate_report()
- logger: LoggingService#
- metadata: MetadataService#
- reporting: ReportingService#
- rerun: RerunService#
- utility: UtilityService#