-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-47233][CONNECT][SS][2/2] Client & Server logic for Client side streaming query listener #46037
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HyukjinKwon
approved these changes
Apr 16, 2024
Member
|
Merged to master. |
WweiL
added a commit
to WweiL/oss-spark
that referenced
this pull request
May 2, 2024
… streaming query listener Server and client side for the client side listener. The client should start send a `add_listener_bus_listener` RPC for the first listener ever added. The server should start a long running thread and register a new "SparkConnectListenerBusListener" upon receiving the RPC, the listener should stream back the listener events to the client using the `responseObserver` created in the `executeHandler` of the `add_listener_bus_listener` call. On the client side, a spark client method: `execute_long_running_command` is created to continuously receive new events from the server with a long-running iterator. The client starts a new thread for handing such events. Please see the graphs below for a more detailed illustration. When either the last client side listener is removed, and the client sends "remove_listener_bus_listener" call, or the `send` method of `SparkConnectListenerBusListener` throws, the long-running server thread is stopped, as an effect, the final `ResultComplete` is sent to the client, closing the client's long-running iterator. Development of spark connect streaming Added unit test. Removed old unit test that created for verifying server-side listener limitations. No Closes apache#46037 from WweiL/SPARK-47233-client-side-listener-2. Authored-by: Wei Liu <[email protected]> Signed-off-by: Hyukjin Kwon <[email protected]>
HyukjinKwon
reviewed
May 21, 2024
| for q in self.spark.streams.active: | ||
| q.stop() | ||
|
|
||
| def test_slow_query(self): |
Member
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems flaky:
======================================================================
FAIL [20.288s]: test_slow_query (pyspark.sql.tests.connect.streaming.test_parity_listener.StreamingListenerParityTests.test_slow_query)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/__w/spark/spark/python/pyspark/sql/tests/connect/streaming/test_parity_listener.py", line 164, in test_slow_query
self.assertTrue(fast_query.id in [str(e.id) for e in listener.terminated])
AssertionError: False is not true
----------------------------------------------------------------------
HyukjinKwon
added a commit
that referenced
this pull request
Jun 28, 2024
…vent assert ### What changes were proposed in this pull request? This PR is a followup of #46037 that adds eventually to terminated event checking ### Why are the changes needed? This test is flaky (https://github.com/apache/spark/actions/runs/9706286442/job/26789758573). ### Does this PR introduce _any_ user-facing change? No, test-only. ### How was this patch tested? Manually ### Was this patch authored or co-authored using generative AI tooling? No. Closes #47139 from HyukjinKwon/SPARK-47233-followup. Authored-by: Hyukjin Kwon <[email protected]> Signed-off-by: Hyukjin Kwon <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Server and client side for the client side listener.
The client should start send a
add_listener_bus_listenerRPC for the first listener ever added.The server should start a long running thread and register a new "SparkConnectListenerBusListener" upon receiving the RPC, the listener should stream back the listener events to the client using the
responseObservercreated in theexecuteHandlerof theadd_listener_bus_listenercall.On the client side, a spark client method:
execute_long_running_commandis created to continuously receive new events from the server with a long-running iterator. The client starts a new thread for handing such events. Please see the graphs below for a more detailed illustration.When either the last client side listener is removed, and the client sends "remove_listener_bus_listener" call, or the
sendmethod ofSparkConnectListenerBusListenerthrows, the long-running server thread is stopped, as an effect, the finalResultCompleteis sent to the client, closing the client's long-running iterator.Why are the changes needed?
Development of spark connect streaming
Does this PR introduce any user-facing change?
How was this patch tested?
Added unit test. Removed old unit test that created for verifying server-side listener limitations.
Was this patch authored or co-authored using generative AI tooling?
No