[SPARK-57467][SCHEDULER] Reuse identical resource profiles when available#56516
Open
psavalle wants to merge 1 commit into
Open
[SPARK-57467][SCHEDULER] Reuse identical resource profiles when available#56516psavalle wants to merge 1 commit into
psavalle wants to merge 1 commit into
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
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?
When registering a resource profile, check if one with the same requests already exists. If so, return it, so that the same executors can be reused.
ResourceProfileManagerhas a methodgetEquivalentProfile, but it is only called inDAGScheduler.mergeResourceProfilesForStagewhenstageResourceProfiles.size > 1. Even there, it seems it may be prone to a race condition since it does not acquire the lock for both steps (checking for a profile, adding one if needed).Why are the changes needed?
Currently, every time a profile is registered, new executors will need to spin up -- even if the resource requests are the same. This is especially problematic with Spark Connect, where different isolated sessions may try and register the same profile, but all end up with isolated executors.
We could also consider putting this behavior behind a configuration flag, if it is desirable to retain the previous behavior by default.
Does this PR introduce any user-facing change?
How was this patch tested?
Added tests
Was this patch authored or co-authored using generative AI tooling?
Yes, modified initial changes provided by Claude.
Generated-by: 2.1.159 (Claude Code)