mirror of
https://github.com/vale981/ray
synced 2025-03-06 02:21:39 -05:00
![]() This PR introduces statically defining ConcurrencyGroup APIs in Java. We introduce 2 APIs: 1. Introducing `@DefConcurrencyGroup` annotation for an actor class to define a concurrency group statically. 2. Introducing `@UseConcurrencyGroup` annotation for actor methods to define the concurrency group to be used in the method. Examples are below: ```java @DefConcurrencyGroup(name = "io", maxConcurrency = 2) @DefConcurrencyGroup(name = "compute", maxConcurrency = 4) private static class MyActor { @UseConcurrencyGroup(name = "io") public long f1() { } @UseConcurrencyGroup(name = "io") public long f2() { } @UseConcurrencyGroup(name = "compute") public long f3(int a, int b) { } @UseConcurrencyGroup(name = "compute") public long f4() { } } ActorHandle<> myActor = Ray.actor(MyActor::new).remote(); myActor.task(MyActor::f1).remote(); myActor.task(MyActor::f2).remote(); myActor.task(MyActor::f3).remote(); myActor.task(MyActor::f4).remote(); ``` `MyActor` has 3 concurrency groups: `io` with 2 concurrency, `compute` with 4 concurrency and `default` with 1 concurrency. f1 and f2 will be executed in `io`, f3 and f4 will be executed in `compute`. |
||
---|---|---|
.. | ||
src/main | ||
pom_template.xml |