[data] remove concurrency lock#56798
Conversation
Signed-off-by: iamjustinhsu <jhsu@anyscale.com>
Signed-off-by: iamjustinhsu <jhsu@anyscale.com>
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
…/remove-udf-lock
Signed-off-by: iamjustinhsu <jhsu@anyscale.com>
python/ray/data/_internal/compute.py
Outdated
| max_size: Optional[int] = None, | ||
| initial_size: Optional[int] = None, | ||
| max_tasks_in_flight_per_actor: Optional[int] = None, | ||
| single_threaded: bool = True, |
There was a problem hiding this comment.
| single_threaded: bool = True, | |
| enable_true_multi_threading: bool = False, |
There was a problem hiding this comment.
Also add ample commentary to explain the difference
e2ed5f3 to
37b9e50
Compare
Signed-off-by: iamjustinhsu <jhsu@anyscale.com>
37b9e50 to
ca15c6d
Compare
Signed-off-by: iamjustinhsu <jhsu@anyscale.com>
Signed-off-by: iamjustinhsu <jhsu@anyscale.com>
e3dd37c to
8c97fb7
Compare
Signed-off-by: iamjustinhsu <jhsu@anyscale.com>
Signed-off-by: iamjustinhsu <jhsu@anyscale.com>
| f"initial_size={self.initial_size}, " | ||
| f"max_tasks_in_flight_per_actor={self.max_tasks_in_flight_per_actor})" | ||
| f"num_workers={self.num_workers}, " | ||
| f"enable_true_multi_threading={self.enable_true_multi_threading}, " |
There was a problem hiding this comment.
Bug: Malformed repr string with misplaced closing parenthesis
The __repr__ method has a closing parenthesis ) at the end of the max_tasks_in_flight_per_actor line, but continues with more fields (num_workers, enable_true_multi_threading, ready_to_total_workers_ratio) followed by another ). This produces malformed output like ActorPoolStrategy(...)num_workers=..., enable_true_multi_threading=..., ...) where fields after the first ) appear outside the constructor notation.
| enable_true_multi_threading: bool = ( | ||
| compute.enable_true_multi_threading | ||
| if isinstance(compute, ActorPoolStrategy) | ||
| else True | ||
| ) |
There was a problem hiding this comment.
Just do it inside _get_udf to avoid duplication
Signed-off-by: iamjustinhsu <jhsu@anyscale.com>
Signed-off-by: iamjustinhsu <jhsu@anyscale.com>
…/remove-udf-lock
| if ( | ||
| not is_async_udf | ||
| and isinstance(compute, ActorPoolStrategy) | ||
| and not compute.enable_true_multi_threading | ||
| ): | ||
| udf = make_callable_class_single_threaded(udf) |
There was a problem hiding this comment.
Add a comment to explain the behavior here
Signed-off-by: Alexey Kudinkin <alexey.kudinkin@gmail.com>
## Why are these changes needed? Currently, users who specify `max_concurrency>1` don't actually experience multi-threaded concurrency in their actors. This PR addresses that by allowing users to override actor pool `max_concurrency` behavior. Changes I made - BY DEFAULT, the behavior before and after this PR is preserved - IF users want to respect `max_concurrency`, they can set `enable_true_multi_threading=True` in their `ActorComputeStrategy` ## Related issue number ray-project#55354 ## Checks ## Tests: NONE YET - [ ] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [ ] I've run `scripts/format.sh` to lint the changes in this PR. - [ ] I've included any doc changes needed for https://docs.ray.io/en/master/. - [ ] I've added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in `doc/source/tune/api/` under the corresponding `.rst` file. - [ ] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [ ] Unit tests - [ ] Release tests - [ ] This PR is not tested :( --------- Signed-off-by: iamjustinhsu <jhsu@anyscale.com> Signed-off-by: Alexey Kudinkin <alexey.kudinkin@gmail.com> Co-authored-by: Alexey Kudinkin <alexey.kudinkin@gmail.com> Signed-off-by: peterxcli <peterxcli@gmail.com>
Why are these changes needed?
Currently, users who specify
max_concurrency>1don't actually experience multi-threaded concurrency in their actors. This PR addresses that by allowing users to override actor poolmax_concurrencybehavior. Changes I mademax_concurrency, they can setenable_true_multi_threading=Truein theirActorComputeStrategyRelated issue number
#55354
Checks
Tests:
NONE YET
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.