Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: tqdm logs within wrap_rank [MLG-1236] #8488

Merged
merged 1 commit into from
Nov 28, 2023
Merged

fix: tqdm logs within wrap_rank [MLG-1236] #8488

merged 1 commit into from
Nov 28, 2023

Conversation

rb-determined-ai
Copy link
Member

This has already been fixed in ship_logs.py, but since ship_logs.py isn't allowed to to have any non-stdlib dependencies (including determined) and since determined can't depend on ship_logs.py (which is only available on-cluster), the right answer is copy/paste.

Copy link

netlify bot commented Nov 28, 2023

Deploy Preview for determined-ui canceled.

Name Link
🔨 Latest commit 456adec
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/656678c7f36c460008a106e0

Copy link
Contributor

@stoksc stoksc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

backend +1

line = f"[rank={rank}] ".encode() + line
os.write(dst_stream.fileno(), line)

# Duplicated in ship_logs.py. If you find a bug here, fix it there too.
Copy link
Contributor

@wes-turner wes-turner Nov 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and its mate are nice comments. Not sure I'd have thought to do it.

from determined.launch import wrap_rank


def test_split_on_new_lines_or_carriage_returns() -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a little pedantic, but I like it when tests test one thing. Even if that means copy/pasted code. Here, what do you think of two tests; one for \n and one for \r?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly also one for stdin one for stderr? Maybe it's worth a short chat about what that division is testing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved; opted to remove the stderr writes. They were intended to be signals but since the stdout reads were blocking it actually made no difference.

stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
assert p.stdin and p.stdout and p.stderr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The more assertions, the less it's clear to me what's under test. Short chat?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed offline, added a comment to the mypy assertion and agreed that the p.wait()==0 is just about being strict, not truly its own test.

Copy link
Contributor

@wes-turner wes-turner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@determined-ci determined-ci requested a review from a team November 28, 2023 19:16
@determined-ci determined-ci added the documentation Improvements or additions to documentation label Nov 28, 2023
- The ``determined.launch.wrap_rank`` module, often used by custom launch layers, had a bug where
it was improperly buffering multiple lines separated by a carriage return, such as logs emitted
from the popular TQDM library. That has been fixed, so TQDM logs should pass through without
undue buffering.
Copy link
Member

@tara-det-ai tara-det-ai Nov 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:orphan:

Bug Fixes

  • Fix an issue where the determined.launch.wrap_rank module, often used by custom launch layers, was improperly buffering multiple lines separated by a carriage return, such as logs emitted
    from the popular TQDM library. TQDM logs will now pass through without undue buffering.

Copy link
Member

@tara-det-ai tara-det-ai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggested edit

This has already been fixed in ship_logs.py, but since ship_logs.py
isn't allowed to to have any non-stdlib dependencies (including
determined) and since determined can't depend on ship_logs.py (which is
only available on-cluster), the right answer is copy/paste.
@determined-ci determined-ci requested a review from a team November 28, 2023 23:33
@rb-determined-ai rb-determined-ai enabled auto-merge (squash) November 28, 2023 23:39
@rb-determined-ai rb-determined-ai merged commit 06b7b79 into main Nov 28, 2023
65 of 79 checks passed
@rb-determined-ai rb-determined-ai deleted the rb/tqdm branch November 28, 2023 23:51
@dannysauer dannysauer added this to the 0.26.5 milestone Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants