Service#
- class torchrl.services.Service(*args, **kwargs)[source]#
Owner-side contract for a long-lived TorchRL service.
A service owns lifecycle and heavy resources.
client()returns the lightweight capability that may be passed to worker processes or actors; that client intentionally has nostartorshutdownmethods.Examples
>>> from torchrl.record.loggers import CSVLogger >>> logger = CSVLogger(exp_name="example", log_dir="/tmp") >>> _ = logger.start() >>> logger.client() is logger True >>> logger.shutdown()
- property is_alive: bool#
Whether the owned service is running.