MolecularDiffusion.modules.models.tabasco.utils.pylogger¶
Classes¶
A multi-GPU-friendly python command line logger. |
Module Contents¶
- class MolecularDiffusion.modules.models.tabasco.utils.pylogger.RankedLogger(name: str = __name__, rank_zero_only: bool = False, extra: Mapping[str, object] | None = None)¶
Bases:
logging.LoggerAdapterA multi-GPU-friendly python command line logger.
Initializes a multi-GPU-friendly python command line logger that logs on all processes with their rank prefixed in the log message.
- Parameters:
name – Name of the Python logger to wrap.
rank_zero_only – If True, emit messages only on rank 0.
extra – Optional context dictionary forwarded to logging.LoggerAdapter.
- log(level: int, msg: str, rank: int | None = None, *args, **kwargs) None¶
Delegate a log call to the underlying logger, after prefixing its message with the rank of the process it’s being logged from. If ‘rank’ is provided, then the log will only occur on that rank/process.
- Parameters:
level – Standard logging level (e.g., logging.INFO).
msg – Message string.
rank – If provided, emit only from this rank. Ignored when rank_zero_only is set.
*args – Positional arguments forwarded to the underlying logger.
**kwargs – Keyword arguments forwarded to the underlying logger.
- rank_zero_only = False¶