Skip to content

Commit 4bfe8f1

Browse files
JoshRosenmarkhamstra
authored andcommitted
Revert "[SPARK-5363] [PySpark] check ending mark in non-block way"
This reverts commits ac6fe67 and c06e42f.
1 parent 3ee4394 commit 4bfe8f1

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -145,24 +145,11 @@ private[spark] class PythonRDD(
145145
stream.readFully(update)
146146
accumulator += Collections.singletonList(update)
147147
}
148-
149148
// Check whether the worker is ready to be re-used.
150-
if (reuse_worker) {
151-
// It has a high possibility that the ending mark is already available,
152-
// And current task should not be blocked by checking it
153-
154-
if (stream.available() >= 4) {
155-
val ending = stream.readInt()
156-
if (ending == SpecialLengths.END_OF_STREAM) {
157-
env.releasePythonWorker(pythonExec, envVars.toMap, worker)
158-
released = true
159-
logInfo(s"Communication with worker ended cleanly, re-use it: $worker")
160-
} else {
161-
logInfo(s"Communication with worker did not end cleanly " +
162-
s"(ending with $ending), close it: $worker")
163-
}
164-
} else {
165-
logInfo(s"The ending mark from worker is not available, close it: $worker")
149+
if (stream.readInt() == SpecialLengths.END_OF_STREAM) {
150+
if (reuse_worker) {
151+
env.releasePythonWorker(pythonExec, envVars.toMap, worker)
152+
released = true
166153
}
167154
}
168155
null

python/pyspark/worker.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ def process():
127127
write_int(len(_accumulatorRegistry), outfile)
128128
for (aid, accum) in _accumulatorRegistry.items():
129129
pickleSer._write_with_length((aid, accum._value), outfile)
130-
outfile.flush()
131130

132131
# check end of stream
133132
if read_int(infile) == SpecialLengths.END_OF_STREAM:

0 commit comments

Comments
 (0)