Fix lost stdout/stderr in secondary threads#31
Merged
parente merged 2 commits intoadtech-labs:masterfrom May 11, 2017
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #31 +/- ##
==========================================
+ Coverage 84.36% 85.35% +0.99%
==========================================
Files 6 6
Lines 403 403
==========================================
+ Hits 340 344 +4
+ Misses 63 59 -4 |
marshall245
approved these changes
May 11, 2017
Collaborator
marshall245
left a comment
There was a problem hiding this comment.
reviewed in person with @parente
Contributor
Author
|
Rebased on latest #30. |
Fixes lost Spark output when Spark has multiple threads and Console.setOut/setErr only affects the current thread.
Read stdout/stderr in larger blocks of bytes not line by line
parente
added a commit
that referenced
this pull request
May 23, 2017
Fix closure problems introduced by #31
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
NOTE: Builds on #30 which should be merged first.
Inject code to set Console stdout/stderr before executing user code. Origin code set them once in the main thread only. Spark creates additional threads and these were still being directed to the terminal.
It'd be nice if we could wrap the creation of the SparkContext in a block that does the redirect so that Spark's threads inherit our settings. However, because we're using pyspark to do that initialization, we don't have good control over that step.
This PR also increases the file read buffer size from Scala to Python from a line per poll to 4096 bytes. This reduces a visible lag in results appearing in a Jupyter notebook, and stabilizes the read size instead of having some very short and some very long reads.
Fixes #26 and #22.