Skip to content

Commit bf795e6

Browse files
d4l3kfacebook-github-bot
authored andcommitted
improve local scheduler log ordering (#366)
Summary: Pull Request resolved: #366 This sets `PYTHONUNBUFFERED` to improve local scheduler logging latency. With this set each python log line gets immediately written out so you avoid large blocks of logs from the buffering. It also preserves groups unlike `readline()` since a stack trace will be written out as a single write There's can still be some small amount of ordering mismatches but it's better than it was before Reviewed By: kiukchung Differential Revision: D33433782 fbshipit-source-id: 3f4a573a9736f1432119eeb9ad4e51e3bff19ada
1 parent 55903b1 commit bf795e6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

torchx/schedulers/local_scheduler.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,9 @@ def _popen(
676676
else:
677677
env["PATH"] = join_PATH(env.get("PATH"), cwd)
678678

679+
# default to unbuffered python for faster responsiveness locally
680+
env.setdefault("PYTHONUNBUFFERED", "x")
681+
679682
args_pfmt = pprint.pformat(asdict(replica_params), indent=2, width=80)
680683
log.debug(f"Running {role_name} (replica {replica_id}):\n {args_pfmt}")
681684

0 commit comments

Comments
 (0)