-
Notifications
You must be signed in to change notification settings - Fork 6.9k
[Data] Improve state initialization for ActorPoolMapOperator
#34037
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
Merged
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
Signed-off-by: amogkam <[email protected]>
Signed-off-by: amogkam <[email protected]>
Signed-off-by: amogkam <[email protected]>
ericl
reviewed
Apr 4, 2023
python/ray/data/_internal/execution/operators/actor_pool_map_operator.py
Show resolved
Hide resolved
ericl
reviewed
Apr 4, 2023
ericl
approved these changes
Apr 4, 2023
Contributor
|
Is the existing approach really once per thread? It looks |
Contributor
Author
|
Right, but race conditions can lead to each thread initializing the callable class. We can either add synchronization (move the class initialization behind a lock) or explicitly do the class initialization in a separate step. |
jianoaix
approved these changes
Apr 5, 2023
Signed-off-by: amogkam <[email protected]>
Signed-off-by: amogkam <[email protected]>
Signed-off-by: amogkam <[email protected]>
c21
approved these changes
Apr 6, 2023
Signed-off-by: amogkam <[email protected]>
Signed-off-by: amogkam <[email protected]>
elliottower
pushed a commit
to elliottower/ray
that referenced
this pull request
Apr 22, 2023
…roject#34037) ActorPoolMapOperator takes in a Callable class which initializes some state to be reused for every batch. In the current implementation, this state is initialized on the first batch, rather than during actor init. In this PR, we separate the state initialization and actually call it during Actor init. This allows state to be initialized for fixed size actor pools, even when tasks are not ready to be dispatched for better pipelining. It also supports using multithreaded actors, so state gets initialized once per actor instead of once per thread. --------- Signed-off-by: amogkam <[email protected]> Signed-off-by: elliottower <[email protected]>
ProjectsByJackHe
pushed a commit
to ProjectsByJackHe/ray
that referenced
this pull request
May 4, 2023
…roject#34037) ActorPoolMapOperator takes in a Callable class which initializes some state to be reused for every batch. In the current implementation, this state is initialized on the first batch, rather than during actor init. In this PR, we separate the state initialization and actually call it during Actor init. This allows state to be initialized for fixed size actor pools, even when tasks are not ready to be dispatched for better pipelining. It also supports using multithreaded actors, so state gets initialized once per actor instead of once per thread. --------- Signed-off-by: amogkam <[email protected]> Signed-off-by: Jack He <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
@author-action-required
The PR author is responsible for the next step. Remove tag to send back to the reviewer.
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.
ActorPoolMapOperatortakes in a Callable class which initializes some state to be reused for every batch.In the current implementation, this state is initialized on the first batch, rather than during actor init.
In this PR, we separate the state initialization and actually call it during Actor init. This allows state to be initialized for fixed size actor pools, even when tasks are not ready to be dispatched for better pipelining. It also supports using multithreaded actors, so state gets initialized once per actor instead of once per thread.
Why are these changes needed?
Related issue number
Checks
git commit -s) in this PR.scripts/format.shto lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/under thecorresponding
.rstfile.