Skip to content
Snippets Groups Projects
Commit ee6e3eff authored by Josh Rosen's avatar Josh Rosen
Browse files

Revert "[SPARK-5363] [PySpark] check ending mark in non-block way"

This reverts commits ac6fe67e and c06e42f2.
parent a65766bf
No related branches found
No related tags found
No related merge requests found
......@@ -144,24 +144,11 @@ private[spark] class PythonRDD(
stream.readFully(update)
accumulator += Collections.singletonList(update)
}
// Check whether the worker is ready to be re-used.
if (reuse_worker) {
// It has a high possibility that the ending mark is already available,
// And current task should not be blocked by checking it
if (stream.available() >= 4) {
val ending = stream.readInt()
if (ending == SpecialLengths.END_OF_STREAM) {
env.releasePythonWorker(pythonExec, envVars.toMap, worker)
released = true
logInfo(s"Communication with worker ended cleanly, re-use it: $worker")
} else {
logInfo(s"Communication with worker did not end cleanly " +
s"(ending with $ending), close it: $worker")
}
} else {
logInfo(s"The ending mark from worker is not available, close it: $worker")
if (stream.readInt() == SpecialLengths.END_OF_STREAM) {
if (reuse_worker) {
env.releasePythonWorker(pythonExec, envVars.toMap, worker)
released = true
}
}
null
......
......@@ -121,7 +121,6 @@ def main(infile, outfile):
write_int(len(_accumulatorRegistry), outfile)
for (aid, accum) in _accumulatorRegistry.items():
pickleSer._write_with_length((aid, accum._value), outfile)
outfile.flush()
# check end of stream
if read_int(infile) == SpecialLengths.END_OF_STREAM:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment