-
Notifications
You must be signed in to change notification settings - Fork 108
: python/tests/test_actors.py: use context mgr for config #1946
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
Closed
shayne-fletcher
wants to merge
2
commits into
meta-pytorch:main
from
shayne-fletcher:export-D87478665
Closed
: python/tests/test_actors.py: use context mgr for config #1946
shayne-fletcher
wants to merge
2
commits into
meta-pytorch:main
from
shayne-fletcher:export-D87478665
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…1932) Summary: replace env-var overrides with `configure`. relax `test_flush_logs_ipython` which before was over-constrained and consequently, highly flaky. Reviewed By: mariusae Differential Revision: D87449483
Summary:
remove manual config save/restore boilerplate:
```
config = get_configuration()
enable_log_forwarding = config["enable_log_forwarding"]
# ... etc
configure(enable_log_forwarding=True, ...)
try:
# test code
finally:
configure(enable_log_forwarding=enable_log_forwarding, ...)
```
replace with context manager phrasing:
```
with configured(enable_log_forwarding=True, enable_file_capture=True, tail_log_lines=100):
# test code
```
i intend to follow this diff up with one for the FD + sys.stdout/sys.stderr redirection
Differential Revision: D87478665
|
@shayne-fletcher has exported this pull request. If you are a Meta employee, you can view the originating Diff in D87478665. |
shayne-fletcher
added a commit
to shayne-fletcher/monarch-1
that referenced
this pull request
Nov 20, 2025
…ch#1946) Summary: following up on mariusae 's comment (https://www.internalfb.com/diff/D87449483?dst_version_fbid=2613910452329247&transaction_fbid=2002832840481448) remove manual config save/restore boilerplate: ``` config = get_configuration() enable_log_forwarding = config["enable_log_forwarding"] # ... etc configure(enable_log_forwarding=True, ...) try: # test code finally: configure(enable_log_forwarding=enable_log_forwarding, ...) ``` replace with a context manager phrasing: ``` with configured(enable_log_forwarding=True, enable_file_capture=True, tail_log_lines=100): # test code ``` i intend to follow this diff up with one for the FD + sys.stdout/sys.stderr redirection Reviewed By: thedavekwon Differential Revision: D87478665
shayne-fletcher
added a commit
to shayne-fletcher/monarch-1
that referenced
this pull request
Nov 20, 2025
…ch#1946) Summary: following up on mariusae 's comment (https://www.internalfb.com/diff/D87449483?dst_version_fbid=2613910452329247&transaction_fbid=2002832840481448) remove manual config save/restore boilerplate: ``` config = get_configuration() enable_log_forwarding = config["enable_log_forwarding"] # ... etc configure(enable_log_forwarding=True, ...) try: # test code finally: configure(enable_log_forwarding=enable_log_forwarding, ...) ``` replace with a context manager phrasing: ``` with configured(enable_log_forwarding=True, enable_file_capture=True, tail_log_lines=100): # test code ``` i intend to follow this diff up with one for the FD + sys.stdout/sys.stderr redirection Reviewed By: thedavekwon Differential Revision: D87478665
shayne-fletcher
added a commit
to shayne-fletcher/monarch-1
that referenced
this pull request
Nov 20, 2025
…ch#1946) Summary: following up on mariusae 's comment (https://www.internalfb.com/diff/D87449483?dst_version_fbid=2613910452329247&transaction_fbid=2002832840481448) remove manual config save/restore boilerplate: ``` config = get_configuration() enable_log_forwarding = config["enable_log_forwarding"] # ... etc configure(enable_log_forwarding=True, ...) try: # test code finally: configure(enable_log_forwarding=enable_log_forwarding, ...) ``` replace with a context manager phrasing: ``` with configured(enable_log_forwarding=True, enable_file_capture=True, tail_log_lines=100): # test code ``` i intend to follow this diff up with one for the FD + sys.stdout/sys.stderr redirection Reviewed By: thedavekwon Differential Revision: D87478665
shayne-fletcher
added a commit
to shayne-fletcher/monarch-1
that referenced
this pull request
Nov 20, 2025
…ch#1946) Summary: following up on mariusae 's comment (https://www.internalfb.com/diff/D87449483?dst_version_fbid=2613910452329247&transaction_fbid=2002832840481448) remove manual config save/restore boilerplate: ``` config = get_configuration() enable_log_forwarding = config["enable_log_forwarding"] # ... etc configure(enable_log_forwarding=True, ...) try: # test code finally: configure(enable_log_forwarding=enable_log_forwarding, ...) ``` replace with a context manager phrasing: ``` with configured(enable_log_forwarding=True, enable_file_capture=True, tail_log_lines=100): # test code ``` i intend to follow this diff up with one for the FD + sys.stdout/sys.stderr redirection Reviewed By: thedavekwon Differential Revision: D87478665
shayne-fletcher
added a commit
to shayne-fletcher/monarch-1
that referenced
this pull request
Nov 20, 2025
…ch#1946) Summary: following up on mariusae 's comment (https://www.internalfb.com/diff/D87449483?dst_version_fbid=2613910452329247&transaction_fbid=2002832840481448) remove manual config save/restore boilerplate: ``` config = get_configuration() enable_log_forwarding = config["enable_log_forwarding"] # ... etc configure(enable_log_forwarding=True, ...) try: # test code finally: configure(enable_log_forwarding=enable_log_forwarding, ...) ``` replace with a context manager phrasing: ``` with configured(enable_log_forwarding=True, enable_file_capture=True, tail_log_lines=100): # test code ``` i intend to follow this diff up with one for the FD + sys.stdout/sys.stderr redirection Reviewed By: thedavekwon Differential Revision: D87478665
shayne-fletcher
added a commit
to shayne-fletcher/monarch-1
that referenced
this pull request
Nov 20, 2025
…ch#1946) Summary: following up on mariusae 's comment (https://www.internalfb.com/diff/D87449483?dst_version_fbid=2613910452329247&transaction_fbid=2002832840481448) remove manual config save/restore boilerplate: ``` config = get_configuration() enable_log_forwarding = config["enable_log_forwarding"] # ... etc configure(enable_log_forwarding=True, ...) try: # test code finally: configure(enable_log_forwarding=enable_log_forwarding, ...) ``` replace with a context manager phrasing: ``` with configured(enable_log_forwarding=True, enable_file_capture=True, tail_log_lines=100): # test code ``` i intend to follow this diff up with one for the FD + sys.stdout/sys.stderr redirection Reviewed By: thedavekwon Differential Revision: D87478665
|
This pull request has been merged in 068c505. |
AlirezaShamsoshoara
pushed a commit
to AlirezaShamsoshoara/monarch
that referenced
this pull request
Nov 20, 2025
…#1946) Summary: Pull Request resolved: meta-pytorch#1946 following up on mariusae 's comment (https://www.internalfb.com/diff/D87449483?dst_version_fbid=2613910452329247&transaction_fbid=2002832840481448) remove manual config save/restore boilerplate: ``` config = get_configuration() enable_log_forwarding = config["enable_log_forwarding"] # ... etc configure(enable_log_forwarding=True, ...) try: # test code finally: configure(enable_log_forwarding=enable_log_forwarding, ...) ``` replace with a context manager phrasing: ``` with configured(enable_log_forwarding=True, enable_file_capture=True, tail_log_lines=100): # test code ``` i intend to follow this diff up with one for the FD + sys.stdout/sys.stderr redirection Reviewed By: thedavekwon Differential Revision: D87478665 fbshipit-source-id: 80e65ee72be72ee1e7ee2aa352600566fc6f0e4c
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
remove manual config save/restore boilerplate:
replace with context manager phrasing:
i intend to follow this diff up with one for the FD + sys.stdout/sys.stderr redirection
Differential Revision: D87478665