-
Notifications
You must be signed in to change notification settings - Fork 25.3k
[Persistent Tasks] Assign based on ProjectId #130391
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
Open
prwhelan
wants to merge
16
commits into
elastic:main
Choose a base branch
from
prwhelan:mp/1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+187
−81
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
8b236cb
[Transform] Assign based on ProjectId
prwhelan f8782f3
Merge branch 'main' into mp/1
prwhelan c16f55d
Merge branch 'main' into mp/1
prwhelan 44e3b7c
Decoupling transform changes since serverless will depend on these ch…
prwhelan e37d6f7
Merge branch 'main' into mp/1
prwhelan 6bceb18
Scope methods to Project and Cluster
prwhelan 2b0146b
Merge branch 'main' into mp/1
prwhelan 32597e4
Revert "Scope methods to Project and Cluster"
prwhelan b38a51b
Assert non-null projectid for project-scoped executors
prwhelan 7daaaef
Fix tests with new assertion
prwhelan 8dfe68b
Point to correct super method
prwhelan 6624a94
Merge branch 'main' into mp/1
prwhelan d51ad0c
Update PersistentTasksExecutor.java
prwhelan 0bd72db
Merge branch 'main' into mp/1
prwhelan f66b63e
Update implementations to protected
prwhelan 96a714f
Merge branch 'main' into mp/1
prwhelan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
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.
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.
We'll probably want to split this method up into a cluster-scoped version and a project-scoped version. The health node persistent task is cluster-scoped, so it doesn't really make sense to have a project ID here or in other cluster-scoped persistent tasks (even though it's nullable). Let me know if "cluster-scoped vs. project-scoped persistent tasks" sound unfamiliar to you, then I (or Yang) can explain what they are. But I'll let @ywangd decide whether he agrees or whether he's fine with the nullable project ID like this.
If we decide to split it up, we can one method without a project ID (for cluster-scoped tasks) and one with a
ProjectState
(instead of aClusterState
andProjectId
). We createdProjectState
to avoid passing cluster states together with project IDs.Uh oh!
There was an error while loading. Please reload this page.
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.
I'm happy to rework this, I'm not thrilled about passing nulls around. I'd be happy to instead add a method to the parent, something like:
and then
PersistentTasksClusterService
can call theProjectState
orClusterState
API depending on the scope of the persistent task? I'm not sure if that is cleaner for the persistent task framework at the base level but it feels cleaner for the implementations.99% of this PR was written by IntelliJ's refactor button so we'd only be throwing away minutes of work =)
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.
Yep, something like that is what I had in mind as well (perhaps with a different name for clarity, i.e.
getProjectScopedAssignment
andgetClusterScopedAssignment
, but that wouldn't be a blocker for me). Curious to hear what Yang thinks of all this.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.
Yeah we can go with two separate methods. The
PersistentTasksExecutor#scope
method can be used to tell the scope of the executor and subsequently call the relevantgetXxxAssignment
method.Theoretically we can have a single overriden generic method for project and cluster scoped task executors, if
ProjectState
andClusterState
shares some interface, e.g.Supplier<ClusterState>
. It should help reducing verbosity of the types. We will still need to check the task executor types and pass eitherClusterState
orProjectState
to the method accordingly. This might be something worth doing in future since it feels like a better type system. But it is definitely outside of this PR.