Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/post_training/utils/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

import logging
import os
import sys


Expand All @@ -11,6 +12,12 @@ def setup_logging(level: int = logging.INFO) -> None:

Call once at the beginning of every entry-point script.
"""
rank = int(os.environ.get("RANK", 0))
if level == logging.INFO and rank > 0:
# Suppress INFO logs from non-main ranks to reduce log spam.
logging.basicConfig(handlers=[logging.NullHandler()], force=True)
return

logging.basicConfig(
level=level,
format="%(asctime)s | %(levelname)-8s | %(name)s | %(message)s",
Expand Down
Loading