jeremyjliu commented on a change in pull request #24811: [SPARK-27962][R][CORE]
Propagate subprocess stdout in deploy.RRunner in exception
URL: https://github.com/apache/spark/pull/24811#discussion_r293090436
##########
File path: core/src/main/scala/org/apache/spark/deploy/RRunner.scala
##########
@@ -100,15 +100,17 @@ object RRunner {
builder.redirectErrorStream(true) // Ugly but needed for stdout and
stderr to synchronize
val process = builder.start()
- new RedirectThread(process.getInputStream, System.out, "redirect R
output").start()
+ val stdoutBuffer = new CircularBuffer(1024)
+ val output = new TeeOutputStream(System.out, stdoutBuffer)
+ new RedirectThread(process.getInputStream, output, "redirect R
output").start()
- process.waitFor()
+ val returnCode = process.waitFor()
+ if (returnCode != 0) {
+ throw SparkUserAppException(returnCode,
Option(stdoutBuffer.toString))
Review comment:
Yes, ideally the error message would be included in the exception message.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]