-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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: allow for stdout and stderr streams to be unbufferred directly. #708
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the performance impacts of making the streams unbuffered? How does this work/degrade in Windows cmd prompt and other non-iterm like terminals? How about through a SSH terminal?
I'd like us to be a bit thorough before enabling it globally.. I am okay if this is selectively added only when debugging because I know we might block the process for too long on sockets at that point..
samcli/cli/main.py
Outdated
@click.command(cls=BaseCommand) | ||
@unbuffered_streams |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we do this selectively only for debugging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For all of debugging? Can we scope this further down than that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can scope it down to say "if you specify a debug port", I think its a fair trade off for performance.
Yeah we can add it to debugging mode. That works, in terms of comparison,
can we run the integration tests with a timer with and without this change
on every platform and verify performance impact? Will that work?
…On Wed, Oct 10, 2018 at 5:20 PM, Sanath Kumar Ramesh < ***@***.***> wrote:
***@***.**** requested changes on this pull request.
What are the performance impacts of making the streams unbuffered? How
does this work/degrade in Windows cmd prompt and other non-iterm like
terminals? How about through a SSH terminal?
I'd like us to be a bit thorough before enabling it globally.. I am okay
if this is selectively added only when debugging because I know we might
block the process for too long on sockets at that point..
------------------------------
In samcli/cli/main.py
<#708 (comment)>:
> @click.command(cls=BaseCommand)
***@***.***_streams
can we do this selectively only for debugging?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#708 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADmJlnZDV4V1ersQrQ5woi1OfKbKC4Qtks5ujo7dgaJpZM4XWe1o>
.
|
So I ran the integration tests with and without this commit on the local invoke path, and found no difference in timings. Without this commit.
With commit
Also setting os.environ will only matter for that session of the invoke. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes more sense now. Thanks!
@@ -13,6 +14,7 @@ def __init__(self, | |||
self.debug_port = debug_port | |||
self.debugger_path = debugger_path | |||
self.debug_args = debug_args | |||
os.environ["PYTHONUNBUFFERED"] = "1" if self.debug_port else "0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually on second thought, can you skip the setting of "0" to facilitate usage of this class in multi-threaded scenarios. If you do
if self.debug_port:
os.environ[...] = 1
then you don't have the race condition to worry about.
f35b8df
to
ec64286
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
* develop: chore: Version bump aws-sam-translator to 1.8.0 (aws#732) docs: add instructions for using local version of SAM Transformer (aws#688) docs: Update Docker command to docker (aws#725) fix: Iterate over query param list chore: Enable Travis to run integ tests chore(0.6.1): SAM CLI Version bump (aws#717) fix(init/readme): Correct permissions for AWS CLI under requirements (aws#713) add pytest-mock for testing (aws#703) fix: allow for stdout and stderr streams to be unbufferred directly. (aws#708) docs: Add installation instructions for linux (Centos) (aws#670) fix: Updated isBase64Encoded value to bool (aws#699) fix: correct launch.json for nodejs debugging through VSCode (aws#704) docs(usage): Update how to debug Python functions using VS Code (aws#694) docs(Cloud9): Reset bash cache on Cloud9 (aws#693) docs: Updated virtualenv alias name for 3.7 in guide. (aws#706) chore: update aws-sam-translator to 1.7.0 (aws#682) feat: travis CI support for Python 3.7 (aws#679) docs: Update generate-sample-event-payloads link (aws#702) Fix: Raise error for invalid environment variables file (aws#675)
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.