WweiL commented on code in PR #46125: URL: https://github.com/apache/spark/pull/46125#discussion_r1571450947
########## python/pyspark/sql/connect/streaming/worker/foreach_batch_worker.py: ########## @@ -63,8 +63,11 @@ def main(infile: IO, outfile: IO) -> None: spark = spark_connect_session # TODO(SPARK-44461): Enable Process Isolation - - func = worker.read_command(pickle_ser, infile) + read_command_exception = None + try: + func = worker.read_command(pickle_ser, infile) + except Exception as e: + read_command_exception = e write_int(0, outfile) # Indicate successful initialization Review Comment: I would actually do a `write_int(-1, outfile)`, then directly write out the error with `handle_worker_exception`, to indicate an unsuccessful initialization. And in [`StreamingPythonRunner`](https://github.com/apache/spark/blob/add49b3c115f34ab8e693f7e67579292afface4c/core/src/main/scala/org/apache/spark/api/python/StreamingPythonRunner.scala#L94), on where we receive this "0", we check if that's -1, if so, then read error and throw -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org