File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed
Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -75,14 +75,19 @@ def main(infile, outfile):
7575 init_time = time .time ()
7676 iterator = deserializer .load_stream (infile )
7777 serializer .dump_stream (func (split_index , iterator ), outfile )
78- except Exception as e :
79- # Write the error to stderr in addition to trying to pass it back to
80- # Java, in case it happened while serializing a record
81- print >> sys .stderr , "PySpark worker failed with exception:"
82- print >> sys .stderr , traceback .format_exc ()
83- write_int (SpecialLengths .PYTHON_EXCEPTION_THROWN , outfile )
84- write_with_length (traceback .format_exc (), outfile )
85- sys .exit (- 1 )
78+ except Exception :
79+ try :
80+ write_int (SpecialLengths .PYTHON_EXCEPTION_THROWN , outfile )
81+ write_with_length (traceback .format_exc (), outfile )
82+ outfile .flush ()
83+ except IOError :
84+ # JVM close the socket
85+ pass
86+ except Exception :
87+ # Write the error to stderr if it happened while serializing
88+ print >> sys .stderr , "PySpark worker failed with exception:"
89+ print >> sys .stderr , traceback .format_exc ()
90+ exit (- 1 )
8691 finish_time = time .time ()
8792 report_times (outfile , boot_time , init_time , finish_time )
8893 # Mark the beginning of the accumulators section of the output
You can’t perform that action at this time.
0 commit comments