Spenserrrr commented on code in PR #59976:
URL: https://github.com/apache/spark/pull/59976#discussion_r4531342459
##########
core/src/main/scala/org/apache/spark/api/python/PythonRunner.scala:
##########
@@ -796,25 +817,27 @@ private[spark] abstract class BasePythonRunner[IN, OUT](
val dataIn = if (usePipelined) {
createPipelinedDataIn(worker, writer, handle, context)
} else {
- new DataInputStream(new BufferedInputStream(
- new ReaderInputStream(worker, writer, handle,
- idleTimeoutSeconds, killOnIdleTimeout, context),
- bufferSize))
+ val input = new ReaderInputStream(worker, writer, handle,
+ idleTimeoutSeconds, killOnIdleTimeout, context)
+ new PythonWorkerInputStream(
+ new BufferedInputStream(input, bufferSize), input.readInitResponse)
}
val stdoutIterator = newReaderIterator(
dataIn, writer, startTime, env, worker, handle, releasedOrClosed,
context)
new InterruptibleIterator(context, stdoutIterator)
}
/**
- * Sets up pipelined mode: switches the socket to blocking mode, starts the
writer
- * thread, configures idle timeout, and returns a DataInputStream for
reading output.
+ * Sets up pipelined mode: switches the socket to blocking mode and
configures idle timeout.
+ * Sends the command and reads the init response synchronously on the task
thread.
+ * After successful init, starts the input writer thread and returns a
DataInputStream
+ * for reading output.
Review Comment:
I separated stream setup from initializePipelinedWorker, which performs the
init exchange before starting the row writer.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]