[SPARK-56661] Implementing UDFDispatcherManager for new UDF worker sessions#55712
Open
sven-weber-db wants to merge 1 commit intoapache:masterfrom
Open
[SPARK-56661] Implementing UDFDispatcherManager for new UDF worker sessions#55712sven-weber-db wants to merge 1 commit intoapache:masterfrom
sven-weber-db wants to merge 1 commit intoapache:masterfrom
Conversation
83e1033 to
184fc44
Compare
|
|
||
| // Must be called while holding `lock`. | ||
| private def handleSessionTermination( | ||
| workerSpec: UDFWorkerSpecification |
Contributor
There was a problem hiding this comment.
maybe we shall also pass the session object here?
Contributor
Author
There was a problem hiding this comment.
Do you mean move the activeSessions.remove(session) call into this function like so?
private def handleSessionTermination(
session: WorkerSession,
workerSpec: UDFWorkerSpecification
): Unit = {
activeSessions.remove(session)
val entry = dispatchers.get(workerSpec)
// Note: entry == null is unexpected and should
// throw here.
entry.activeSessionCount -= 1
if (entry.activeSessionCount == 0) {
logger.info("All sessions closed for dispatcher " +
s"${entry.dispatcher.dispatcherId}, removing from cache")
dispatchers.remove(workerSpec)
onAllDispatcherSessionsClosed(entry.dispatcher)
}
}c1e56ab to
7c77e8d
Compare
7c77e8d to
1f11959
Compare
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
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?
This PR implements a
UDFDispatcherManagerclass in the new/udfpackage that was initiated by SPIP SPARK-55278. The purpose of the new Manager class is to provide a single entry-point for Spark with which a UDF session to a external UDF worker can be created, based on aWorkerSpecificationinstance. This manager and entry-point will be used by follow-up PRs to implement new, language agnostic Catalyst nodes.Why are the changes needed?
The
UDFWorkerManagerserves two main purposes:WorkerDispachterclasses - depending on theUDFWorkerSpecificationthey are created for. This is required because the newly proposed UDF framework from SPIP SPARK-55278, enables clients to specify different UDF dispatchers for their UDFs. This implies:2.1. Multiple, different dispatchers can exist at the same time
-> The right one needs to be selected to create a UDF session
2.2. Dispatcher lifetime needs to be managed
-> Dispatchers and their resources need to be cleaned-up if they are no longer needed by clients
Does this PR introduce any user-facing change?
No - All changes are marked as
Experimentaland not yet consumed.How was this patch tested?
New unit-tests where added for the changes in the
UDFDispatcherManagerandWorkerSessionWas this patch authored or co-authored using generative AI tooling?
Partially. However, the code was manually reviewed and adjusted.