mirror of
https://github.com/wassname/ray.git
synced 2026-06-27 21:23:10 +08:00
[Java] Fix return of java doc (#13601)
This commit is contained in:
@@ -51,7 +51,7 @@ public final class Ray extends RayCall {
|
||||
/**
|
||||
* Check if {@link #init} has been called yet.
|
||||
*
|
||||
* <p>Returns True if {@link #init} has already been called and false otherwise.
|
||||
* @return True if {@link #init} has already been called and false otherwise.
|
||||
*/
|
||||
public static boolean isInitialized() {
|
||||
return runtime != null;
|
||||
@@ -60,8 +60,8 @@ public final class Ray extends RayCall {
|
||||
/**
|
||||
* Store an object in the object store.
|
||||
*
|
||||
* @param obj The Java object to be stored. Returns A ObjectRef instance that represents the
|
||||
* in-store object.
|
||||
* @param obj The Java object to be stored.
|
||||
* @return A ObjectRef instance that represents the in-store object.
|
||||
*/
|
||||
public static <T> ObjectRef<T> put(T obj) {
|
||||
return internal().put(obj);
|
||||
@@ -70,7 +70,8 @@ public final class Ray extends RayCall {
|
||||
/**
|
||||
* Get an object by `ObjectRef` from the object store.
|
||||
*
|
||||
* @param objectRef The reference of the object to get. Returns The Java object.
|
||||
* @param objectRef The reference of the object to get.
|
||||
* @return The Java object.
|
||||
*/
|
||||
public static <T> T get(ObjectRef<T> objectRef) {
|
||||
return internal().get(objectRef);
|
||||
@@ -79,7 +80,8 @@ public final class Ray extends RayCall {
|
||||
/**
|
||||
* Get a list of objects by `ObjectRef`s from the object store.
|
||||
*
|
||||
* @param objectList A list of object references. Returns A list of Java objects.
|
||||
* @param objectList A list of object references.
|
||||
* @return A list of Java objects.
|
||||
*/
|
||||
public static <T> List<T> get(List<ObjectRef<T>> objectList) {
|
||||
return internal().get(objectList);
|
||||
@@ -91,8 +93,8 @@ public final class Ray extends RayCall {
|
||||
*
|
||||
* @param waitList A list of object references to wait for.
|
||||
* @param numReturns The number of objects that should be returned.
|
||||
* @param timeoutMs The maximum time in milliseconds to wait before returning. Returns Two lists,
|
||||
* one containing locally available objects, one containing the rest.
|
||||
* @param timeoutMs The maximum time in milliseconds to wait before returning.
|
||||
* @return Two lists, one containing locally available objects, one containing the rest.
|
||||
*/
|
||||
public static <T> WaitResult<T> wait(List<ObjectRef<T>> waitList, int numReturns, int timeoutMs) {
|
||||
return internal().wait(waitList, numReturns, timeoutMs);
|
||||
@@ -103,8 +105,8 @@ public final class Ray extends RayCall {
|
||||
* objects are locally available.
|
||||
*
|
||||
* @param waitList A list of object references to wait for.
|
||||
* @param numReturns The number of objects that should be returned. Returns Two lists, one
|
||||
* containing locally available objects, one containing the rest.
|
||||
* @param numReturns The number of objects that should be returned.
|
||||
* @return Two lists, one containing locally available objects, one containing the rest.
|
||||
*/
|
||||
public static <T> WaitResult<T> wait(List<ObjectRef<T>> waitList, int numReturns) {
|
||||
return internal().wait(waitList, numReturns, Integer.MAX_VALUE);
|
||||
@@ -114,8 +116,8 @@ public final class Ray extends RayCall {
|
||||
* A convenient helper method for Ray.wait. It will wait infinitely until all objects are locally
|
||||
* available.
|
||||
*
|
||||
* @param waitList A list of object references to wait for. Returns Two lists, one containing
|
||||
* locally available objects, one containing the rest.
|
||||
* @param waitList A list of object references to wait for.
|
||||
* @return Two lists, one containing locally available objects, one containing the rest.
|
||||
*/
|
||||
public static <T> WaitResult<T> wait(List<ObjectRef<T>> waitList) {
|
||||
return internal().wait(waitList, waitList.size(), Integer.MAX_VALUE);
|
||||
@@ -127,8 +129,9 @@ public final class Ray extends RayCall {
|
||||
* <p>Gets a handle to a named actor with the given name. The actor must have been created with
|
||||
* name specified.
|
||||
*
|
||||
* @param name The name of the named actor. Returns an ActorHandle to the actor if the actor of
|
||||
* specified name exists or an Optional.empty()
|
||||
* @param name The name of the named actor.
|
||||
* @return an ActorHandle to the actor if the actor of specified name exists or an
|
||||
* Optional.empty()
|
||||
*/
|
||||
public static <T extends BaseActorHandle> Optional<T> getActor(String name) {
|
||||
return internal().getActor(name, false);
|
||||
@@ -140,8 +143,9 @@ public final class Ray extends RayCall {
|
||||
* <p>Gets a handle to a global named actor with the given name. The actor must have been created
|
||||
* with global name specified.
|
||||
*
|
||||
* @param name The global name of the named actor. Returns an ActorHandle to the actor if the
|
||||
* actor of specified name exists or an Optional.empty()
|
||||
* @param name The global name of the named actor.
|
||||
* @return an ActorHandle to the actor if the actor of specified name exists or an
|
||||
* Optional.empty()
|
||||
*/
|
||||
public static <T extends BaseActorHandle> Optional<T> getGlobalActor(String name) {
|
||||
return internal().getActor(name, true);
|
||||
@@ -151,7 +155,7 @@ public final class Ray extends RayCall {
|
||||
* If users want to use Ray API in their own threads, call this method to get the async context
|
||||
* and then call {@link #setAsyncContext} at the beginning of the new thread.
|
||||
*
|
||||
* <p>Returns The async context.
|
||||
* @return The async context.
|
||||
*/
|
||||
public static Object getAsyncContext() {
|
||||
return internal().getAsyncContext();
|
||||
@@ -175,7 +179,8 @@ public final class Ray extends RayCall {
|
||||
* If users want to use Ray API in their own threads, they should wrap their {@link Runnable}
|
||||
* objects with this method.
|
||||
*
|
||||
* @param runnable The runnable to wrap. Returns The wrapped runnable.
|
||||
* @param runnable The runnable to wrap.
|
||||
* @return The wrapped runnable.
|
||||
*/
|
||||
public static Runnable wrapRunnable(Runnable runnable) {
|
||||
return internal().wrapRunnable(runnable);
|
||||
@@ -185,7 +190,8 @@ public final class Ray extends RayCall {
|
||||
* If users want to use Ray API in their own threads, they should wrap their {@link Callable}
|
||||
* objects with this method.
|
||||
*
|
||||
* @param callable The callable to wrap. Returns The wrapped callable.
|
||||
* @param callable The callable to wrap.
|
||||
* @return The wrapped callable.
|
||||
*/
|
||||
public static <T> Callable<T> wrapCallable(Callable<T> callable) {
|
||||
return internal().wrapCallable(callable);
|
||||
@@ -238,7 +244,8 @@ public final class Ray extends RayCall {
|
||||
*
|
||||
* @param name Name of the placement group.
|
||||
* @param bundles Pre-allocated resource list.
|
||||
* @param strategy Actor placement strategy. Returns A handle to the created placement group.
|
||||
* @param strategy Actor placement strategy.
|
||||
* @return A handle to the created placement group.
|
||||
*/
|
||||
public static PlacementGroup createPlacementGroup(
|
||||
String name, List<Map<String, Double>> bundles, PlacementStrategy strategy) {
|
||||
@@ -265,7 +272,8 @@ public final class Ray extends RayCall {
|
||||
/**
|
||||
* Get a placement group by placement group Id.
|
||||
*
|
||||
* @param id placement group id. Returns The placement group.
|
||||
* @param id placement group id.
|
||||
* @return The placement group.
|
||||
*/
|
||||
public static PlacementGroup getPlacementGroup(PlacementGroupId id) {
|
||||
return internal().getPlacementGroup(id);
|
||||
@@ -274,7 +282,7 @@ public final class Ray extends RayCall {
|
||||
/**
|
||||
* Get all placement groups in this cluster.
|
||||
*
|
||||
* <p>Returns All placement groups.
|
||||
* @return All placement groups.
|
||||
*/
|
||||
public static List<PlacementGroup> getAllPlacementGroups() {
|
||||
return internal().getAllPlacementGroups();
|
||||
|
||||
@@ -23,7 +23,8 @@ public class ActorCreator<A> extends BaseActorCreator<ActorCreator<A>> {
|
||||
*
|
||||
* <p>Note, if this is set, this actor won't share Java worker with other actors or tasks.
|
||||
*
|
||||
* @param jvmOptions JVM options for the Java worker that this actor is running in. Returns self
|
||||
* @param jvmOptions JVM options for the Java worker that this actor is running in.
|
||||
* @return self
|
||||
* @see io.ray.api.options.ActorCreationOptions.Builder#setJvmOptions(java.lang.String)
|
||||
*/
|
||||
public ActorCreator<A> setJvmOptions(String jvmOptions) {
|
||||
@@ -34,7 +35,7 @@ public class ActorCreator<A> extends BaseActorCreator<ActorCreator<A>> {
|
||||
/**
|
||||
* Create a java actor remotely and return a handle to the created actor.
|
||||
*
|
||||
* <p>Returns a handle to the created java actor.
|
||||
* @return a handle to the created java actor.
|
||||
*/
|
||||
public ActorHandle<A> remote() {
|
||||
return Ray.internal().createActor(func, args, buildOptions());
|
||||
|
||||
@@ -25,7 +25,7 @@ public class ActorTaskCaller<R> {
|
||||
* Execute an java actor method remotely and return an object reference to the result object in
|
||||
* the object store.
|
||||
*
|
||||
* <p>Returns an object reference to an object in the object store.
|
||||
* @return an object reference to an object in the object store.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public ObjectRef<R> remote() {
|
||||
|
||||
@@ -18,7 +18,8 @@ public class BaseActorCreator<T extends BaseActorCreator> {
|
||||
* name via {@link Ray#getActor(java.lang.String)}. If you want create a named actor that is
|
||||
* accessible from all jobs, use {@link BaseActorCreator#setGlobalName(java.lang.String)} instead.
|
||||
*
|
||||
* @param name The name of the named actor. Returns self
|
||||
* @param name The name of the named actor.
|
||||
* @return self
|
||||
* @see io.ray.api.options.ActorCreationOptions.Builder#setName(String)
|
||||
*/
|
||||
public T setName(String name) {
|
||||
@@ -31,7 +32,8 @@ public class BaseActorCreator<T extends BaseActorCreator> {
|
||||
* Ray#getGlobalActor(java.lang.String)}. If you want to create a named actor that is only
|
||||
* accessible from this job, use {@link BaseActorCreator#setName(java.lang.String)} instead.
|
||||
*
|
||||
* @param name The name of the named actor. Returns self
|
||||
* @param name The name of the named actor.
|
||||
* @return self
|
||||
* @see io.ray.api.options.ActorCreationOptions.Builder#setGlobalName(String)
|
||||
*/
|
||||
public T setGlobalName(String name) {
|
||||
@@ -45,7 +47,8 @@ public class BaseActorCreator<T extends BaseActorCreator> {
|
||||
* used.
|
||||
*
|
||||
* @param resourceName resource name
|
||||
* @param resourceQuantity resource quantity Returns self
|
||||
* @param resourceQuantity resource quantity
|
||||
* @return self
|
||||
* @see ActorCreationOptions.Builder#setResource(java.lang.String, java.lang.Double)
|
||||
*/
|
||||
public T setResource(String resourceName, Double resourceQuantity) {
|
||||
@@ -58,7 +61,8 @@ public class BaseActorCreator<T extends BaseActorCreator> {
|
||||
* called multiple times. If the same resource is set multiple times, the latest quantity will be
|
||||
* used.
|
||||
*
|
||||
* @param resources requirements for multiple resources. Returns self
|
||||
* @param resources requirements for multiple resources.
|
||||
* @return self
|
||||
* @see BaseActorCreator#setResources(java.util.Map)
|
||||
*/
|
||||
public T setResources(Map<String, Double> resources) {
|
||||
@@ -71,7 +75,8 @@ public class BaseActorCreator<T extends BaseActorCreator> {
|
||||
* unexpectedly. The minimum valid value is 0 (default), which indicates that the actor doesn't
|
||||
* need to be restarted. A value of -1 indicates that an actor should be restarted indefinitely.
|
||||
*
|
||||
* @param maxRestarts max number of actor restarts Returns self
|
||||
* @param maxRestarts max number of actor restarts
|
||||
* @return self
|
||||
* @see ActorCreationOptions.Builder#setMaxRestarts(int)
|
||||
*/
|
||||
public T setMaxRestarts(int maxRestarts) {
|
||||
@@ -85,7 +90,8 @@ public class BaseActorCreator<T extends BaseActorCreator> {
|
||||
* <p>The max concurrency defaults to 1 for threaded execution. Note that the execution order is
|
||||
* not guaranteed when {@code max_concurrency > 1}.
|
||||
*
|
||||
* @param maxConcurrency The max number of concurrent calls to allow for this actor. Returns self
|
||||
* @param maxConcurrency The max number of concurrent calls to allow for this actor.
|
||||
* @return self
|
||||
* @see ActorCreationOptions.Builder#setMaxConcurrency(int)
|
||||
*/
|
||||
public T setMaxConcurrency(int maxConcurrency) {
|
||||
@@ -97,7 +103,8 @@ public class BaseActorCreator<T extends BaseActorCreator> {
|
||||
* Set the placement group to place this actor in.
|
||||
*
|
||||
* @param group The placement group of the actor.
|
||||
* @param bundleIndex The index of the bundle to place this actor in. Returns self
|
||||
* @param bundleIndex The index of the bundle to place this actor in.
|
||||
* @return self
|
||||
* @see ActorCreationOptions.Builder#setPlacementGroup(PlacementGroup, int)
|
||||
*/
|
||||
public T setPlacementGroup(PlacementGroup group, int bundleIndex) {
|
||||
|
||||
@@ -14,7 +14,8 @@ public class BaseTaskCaller<T extends BaseTaskCaller<T>> {
|
||||
/**
|
||||
* Set a name for this task.
|
||||
*
|
||||
* @param name task name Returns self
|
||||
* @param name task name
|
||||
* @return self
|
||||
* @see CallOptions.Builder#setName(java.lang.String)
|
||||
*/
|
||||
public T setName(String name) {
|
||||
@@ -27,7 +28,8 @@ public class BaseTaskCaller<T extends BaseTaskCaller<T>> {
|
||||
* times. If the same resource is set multiple times, the latest quantity will be used.
|
||||
*
|
||||
* @param name resource name
|
||||
* @param value resource capacity Returns self
|
||||
* @param value resource capacity
|
||||
* @return self
|
||||
* @see CallOptions.Builder#setResource(java.lang.String, java.lang.Double)
|
||||
*/
|
||||
public T setResource(String name, Double value) {
|
||||
@@ -39,7 +41,8 @@ public class BaseTaskCaller<T extends BaseTaskCaller<T>> {
|
||||
* Set custom requirements for multiple resources. This method can be called multiple times. If
|
||||
* the same resource is set multiple times, the latest quantity will be used.
|
||||
*
|
||||
* @param resources requirements for multiple resources. Returns self
|
||||
* @param resources requirements for multiple resources.
|
||||
* @return self
|
||||
* @see CallOptions.Builder#setResources(java.util.Map)
|
||||
*/
|
||||
public T setResources(Map<String, Double> resources) {
|
||||
|
||||
@@ -17,7 +17,7 @@ public class PyActorCreator extends BaseActorCreator<PyActorCreator> {
|
||||
/**
|
||||
* Create a python actor remotely and return a handle to the created actor.
|
||||
*
|
||||
* <p>Returns a handle to the created python actor.
|
||||
* @return a handle to the created python actor.
|
||||
*/
|
||||
public PyActorHandle remote() {
|
||||
return Ray.internal().createActor(pyActorClass, args, buildOptions());
|
||||
|
||||
@@ -25,7 +25,7 @@ public class PyActorTaskCaller<R> {
|
||||
* Execute a python actor method remotely and return an object reference to the result object in
|
||||
* the object store.
|
||||
*
|
||||
* <p>Returns an object reference to an object in the object store.
|
||||
* @return an object reference to an object in the object store.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public ObjectRef<R> remote() {
|
||||
|
||||
@@ -22,7 +22,7 @@ public class PyTaskCaller<R> extends BaseTaskCaller<PyTaskCaller<R>> {
|
||||
* Execute a python function remotely and return an object reference to the result object in the
|
||||
* object store.
|
||||
*
|
||||
* <p>Returns an object reference to an object in the object store.
|
||||
* @return an object reference to an object in the object store.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public ObjectRef<R> remote() {
|
||||
|
||||
@@ -22,7 +22,7 @@ public class TaskCaller<R> extends BaseTaskCaller<TaskCaller<R>> {
|
||||
* Execute a java function remotely and return an object reference to the result object in the
|
||||
* object store.
|
||||
*
|
||||
* <p>Returns an object reference to an object in the object store.
|
||||
* @return an object reference to an object in the object store.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public ObjectRef<R> remote() {
|
||||
|
||||
@@ -38,7 +38,8 @@ public class PyActorClass {
|
||||
* Create a python actor class.
|
||||
*
|
||||
* @param moduleName The full module name of this actor class
|
||||
* @param className The name of this actor class Returns a python actor class
|
||||
* @param className The name of this actor class
|
||||
* @return a python actor class
|
||||
*/
|
||||
public static PyActorClass of(String moduleName, String className) {
|
||||
return new PyActorClass(moduleName, className);
|
||||
|
||||
@@ -43,7 +43,8 @@ public class PyActorMethod<R> {
|
||||
/**
|
||||
* Create a python actor method.
|
||||
*
|
||||
* @param methodName The name of this actor method Returns a python actor method.
|
||||
* @param methodName The name of this actor method
|
||||
* @return a python actor method.
|
||||
*/
|
||||
public static PyActorMethod<Object> of(String methodName) {
|
||||
return of(methodName, Object.class);
|
||||
@@ -54,7 +55,8 @@ public class PyActorMethod<R> {
|
||||
*
|
||||
* @param methodName The name of this actor method
|
||||
* @param returnType Class of the return value of this actor method
|
||||
* @param <R> The type of the return value of this actor method Returns a python actor method.
|
||||
* @param <R> The type of the return value of this actor method
|
||||
* @return a python actor method.
|
||||
*/
|
||||
public static <R> PyActorMethod<R> of(String methodName, Class<R> returnType) {
|
||||
return new PyActorMethod<>(methodName, returnType);
|
||||
|
||||
@@ -49,7 +49,8 @@ public class PyFunction<R> {
|
||||
* Create a python function.
|
||||
*
|
||||
* @param moduleName The full module name of this function
|
||||
* @param functionName The name of this function Returns a python function.
|
||||
* @param functionName The name of this function
|
||||
* @return a python function.
|
||||
*/
|
||||
public static PyFunction<Object> of(String moduleName, String functionName) {
|
||||
return of(moduleName, functionName, Object.class);
|
||||
@@ -61,7 +62,8 @@ public class PyFunction<R> {
|
||||
* @param moduleName The full module name of this function
|
||||
* @param functionName The name of this function
|
||||
* @param returnType Class of the return value of this function
|
||||
* @param <R> Type of the return value of this function Returns a python function.
|
||||
* @param <R> Type of the return value of this function
|
||||
* @return a python function.
|
||||
*/
|
||||
public static <R> PyFunction<R> of(String moduleName, String functionName, Class<R> returnType) {
|
||||
return new PyFunction<>(moduleName, functionName, returnType);
|
||||
|
||||
@@ -52,7 +52,7 @@ public abstract class BaseId implements Serializable {
|
||||
/**
|
||||
* Derived class should implement this function.
|
||||
*
|
||||
* <p>Returns The length of this id in bytes.
|
||||
* @return The length of this id in bytes.
|
||||
*/
|
||||
public abstract int size();
|
||||
|
||||
|
||||
@@ -50,7 +50,8 @@ public class ActorCreationOptions extends BaseTaskOptions {
|
||||
* this name via {@link Ray#getActor(java.lang.String)}. If you want create a named actor that
|
||||
* is accessible from all jobs, use {@link Builder#setGlobalName(java.lang.String)} instead.
|
||||
*
|
||||
* @param name The name of the named actor. Returns self
|
||||
* @param name The name of the named actor.
|
||||
* @return self
|
||||
*/
|
||||
public Builder setName(String name) {
|
||||
this.name = name;
|
||||
@@ -63,7 +64,8 @@ public class ActorCreationOptions extends BaseTaskOptions {
|
||||
* {@link Ray#getGlobalActor(java.lang.String)}. If you want to create a named actor that is
|
||||
* only accessible from this job, use {@link Builder#setName(java.lang.String)} instead.
|
||||
*
|
||||
* @param name The name of the named actor. Returns self
|
||||
* @param name The name of the named actor.
|
||||
* @return self
|
||||
*/
|
||||
public Builder setGlobalName(String name) {
|
||||
this.name = name;
|
||||
@@ -77,7 +79,8 @@ public class ActorCreationOptions extends BaseTaskOptions {
|
||||
* will be used.
|
||||
*
|
||||
* @param resourceName resource name
|
||||
* @param resourceQuantity resource quantity Returns self
|
||||
* @param resourceQuantity resource quantity
|
||||
* @return self
|
||||
*/
|
||||
public Builder setResource(String resourceName, Double resourceQuantity) {
|
||||
this.resources.put(resourceName, resourceQuantity);
|
||||
@@ -89,7 +92,8 @@ public class ActorCreationOptions extends BaseTaskOptions {
|
||||
* be called multiple times. If the same resource is set multiple times, the latest quantity
|
||||
* will be used.
|
||||
*
|
||||
* @param resources requirements for multiple resources. Returns self
|
||||
* @param resources requirements for multiple resources.
|
||||
* @return self
|
||||
*/
|
||||
public Builder setResources(Map<String, Double> resources) {
|
||||
this.resources.putAll(resources);
|
||||
@@ -101,7 +105,8 @@ public class ActorCreationOptions extends BaseTaskOptions {
|
||||
* unexpectedly. The minimum valid value is 0 (default), which indicates that the actor doesn't
|
||||
* need to be restarted. A value of -1 indicates that an actor should be restarted indefinitely.
|
||||
*
|
||||
* @param maxRestarts max number of actor restarts Returns self
|
||||
* @param maxRestarts max number of actor restarts
|
||||
* @return self
|
||||
*/
|
||||
public Builder setMaxRestarts(int maxRestarts) {
|
||||
this.maxRestarts = maxRestarts;
|
||||
@@ -113,7 +118,8 @@ public class ActorCreationOptions extends BaseTaskOptions {
|
||||
*
|
||||
* <p>Note, if this is set, this actor won't share Java worker with other actors or tasks.
|
||||
*
|
||||
* @param jvmOptions JVM options for the Java worker that this actor is running in. Returns self
|
||||
* @param jvmOptions JVM options for the Java worker that this actor is running in.
|
||||
* @return self
|
||||
*/
|
||||
public Builder setJvmOptions(String jvmOptions) {
|
||||
this.jvmOptions = jvmOptions;
|
||||
@@ -126,8 +132,8 @@ public class ActorCreationOptions extends BaseTaskOptions {
|
||||
* <p>The max concurrency defaults to 1 for threaded execution. Note that the execution order is
|
||||
* not guaranteed when {@code max_concurrency > 1}.
|
||||
*
|
||||
* @param maxConcurrency The max number of concurrent calls to allow for this actor. Returns
|
||||
* self
|
||||
* @param maxConcurrency The max number of concurrent calls to allow for this actor.
|
||||
* @return self
|
||||
*/
|
||||
public Builder setMaxConcurrency(int maxConcurrency) {
|
||||
if (maxConcurrency <= 0) {
|
||||
@@ -142,7 +148,8 @@ public class ActorCreationOptions extends BaseTaskOptions {
|
||||
* Set the placement group to place this actor in.
|
||||
*
|
||||
* @param group The placement group of the actor.
|
||||
* @param bundleIndex The index of the bundle to place this actor in. Returns self
|
||||
* @param bundleIndex The index of the bundle to place this actor in.
|
||||
* @return self
|
||||
*/
|
||||
public Builder setPlacementGroup(PlacementGroup group, int bundleIndex) {
|
||||
this.group = group;
|
||||
|
||||
@@ -22,7 +22,8 @@ public class CallOptions extends BaseTaskOptions {
|
||||
/**
|
||||
* Set a name for this task.
|
||||
*
|
||||
* @param name task name Returns self
|
||||
* @param name task name
|
||||
* @return self
|
||||
*/
|
||||
public Builder setName(String name) {
|
||||
this.name = name;
|
||||
@@ -34,7 +35,8 @@ public class CallOptions extends BaseTaskOptions {
|
||||
* multiple times. If the same resource is set multiple times, the latest quantity will be used.
|
||||
*
|
||||
* @param name resource name
|
||||
* @param value resource capacity Returns self
|
||||
* @param value resource capacity
|
||||
* @return self
|
||||
*/
|
||||
public Builder setResource(String name, Double value) {
|
||||
this.resources.put(name, value);
|
||||
@@ -45,7 +47,8 @@ public class CallOptions extends BaseTaskOptions {
|
||||
* Set custom requirements for multiple resources. This method can be called multiple times. If
|
||||
* the same resource is set multiple times, the latest quantity will be used.
|
||||
*
|
||||
* @param resources requirements for multiple resources. Returns self
|
||||
* @param resources requirements for multiple resources.
|
||||
* @return self
|
||||
*/
|
||||
public Builder setResources(Map<String, Double> resources) {
|
||||
this.resources.putAll(resources);
|
||||
|
||||
@@ -31,22 +31,24 @@ public interface RayRuntime {
|
||||
/**
|
||||
* Store an object in the object store.
|
||||
*
|
||||
* @param obj The Java object to be stored. Returns A ObjectRef instance that represents the
|
||||
* in-store object.
|
||||
* @param obj The Java object to be stored.
|
||||
* @return A ObjectRef instance that represents the in-store object.
|
||||
*/
|
||||
<T> ObjectRef<T> put(T obj);
|
||||
|
||||
/**
|
||||
* Get an object from the object store.
|
||||
*
|
||||
* @param objectRef The reference of the object to get. Returns The Java object.
|
||||
* @param objectRef The reference of the object to get.
|
||||
* @return The Java object.
|
||||
*/
|
||||
<T> T get(ObjectRef<T> objectRef);
|
||||
|
||||
/**
|
||||
* Get a list of objects from the object store.
|
||||
*
|
||||
* @param objectRefs The list of object references. Returns A list of Java objects.
|
||||
* @param objectRefs The list of object references.
|
||||
* @return A list of Java objects.
|
||||
*/
|
||||
<T> List<T> get(List<ObjectRef<T>> objectRefs);
|
||||
|
||||
@@ -56,8 +58,8 @@ public interface RayRuntime {
|
||||
*
|
||||
* @param waitList A list of ObjectRef to wait for.
|
||||
* @param numReturns The number of objects that should be returned.
|
||||
* @param timeoutMs The maximum time in milliseconds to wait before returning. Returns Two lists,
|
||||
* one containing locally available objects, one containing the rest.
|
||||
* @param timeoutMs The maximum time in milliseconds to wait before returning.
|
||||
* @return Two lists, one containing locally available objects, one containing the rest.
|
||||
*/
|
||||
<T> WaitResult<T> wait(List<ObjectRef<T>> waitList, int numReturns, int timeoutMs);
|
||||
|
||||
@@ -87,7 +89,8 @@ public interface RayRuntime {
|
||||
* name specified.
|
||||
*
|
||||
* @param name The name of the named actor.
|
||||
* @param global Whether the named actor is global. Returns ActorHandle to the actor.
|
||||
* @param global Whether the named actor is global.
|
||||
* @return ActorHandle to the actor.
|
||||
*/
|
||||
<T extends BaseActorHandle> Optional<T> getActor(String name, boolean global);
|
||||
|
||||
@@ -104,7 +107,8 @@ public interface RayRuntime {
|
||||
*
|
||||
* @param func The remote function to run.
|
||||
* @param args The arguments of the remote function.
|
||||
* @param options The options for this call. Returns The result object.
|
||||
* @param options The options for this call.
|
||||
* @return The result object.
|
||||
*/
|
||||
ObjectRef call(RayFunc func, Object[] args, CallOptions options);
|
||||
|
||||
@@ -113,7 +117,8 @@ public interface RayRuntime {
|
||||
*
|
||||
* @param pyFunction The Python function.
|
||||
* @param args Arguments of the function.
|
||||
* @param options The options for this call. Returns The result object.
|
||||
* @param options The options for this call.
|
||||
* @return The result object.
|
||||
*/
|
||||
ObjectRef call(PyFunction pyFunction, Object[] args, CallOptions options);
|
||||
|
||||
@@ -122,7 +127,8 @@ public interface RayRuntime {
|
||||
*
|
||||
* @param actor A handle to the actor.
|
||||
* @param func The remote function to run, it must be a method of the given actor.
|
||||
* @param args The arguments of the remote function. Returns The result object.
|
||||
* @param args The arguments of the remote function.
|
||||
* @return The result object.
|
||||
*/
|
||||
ObjectRef callActor(ActorHandle<?> actor, RayFunc func, Object[] args);
|
||||
|
||||
@@ -131,7 +137,8 @@ public interface RayRuntime {
|
||||
*
|
||||
* @param pyActor A handle to the actor.
|
||||
* @param pyActorMethod The actor method.
|
||||
* @param args Arguments of the function. Returns The result object.
|
||||
* @param args Arguments of the function.
|
||||
* @return The result object.
|
||||
*/
|
||||
ObjectRef callActor(PyActorHandle pyActor, PyActorMethod pyActorMethod, Object[] args);
|
||||
|
||||
@@ -141,7 +148,8 @@ public interface RayRuntime {
|
||||
* @param actorFactoryFunc A remote function whose return value is the actor object.
|
||||
* @param args The arguments for the remote function.
|
||||
* @param <T> The type of the actor object.
|
||||
* @param options The options for creating actor. Returns A handle to the actor.
|
||||
* @param options The options for creating actor.
|
||||
* @return A handle to the actor.
|
||||
*/
|
||||
<T> ActorHandle<T> createActor(
|
||||
RayFunc actorFactoryFunc, Object[] args, ActorCreationOptions options);
|
||||
@@ -151,7 +159,8 @@ public interface RayRuntime {
|
||||
*
|
||||
* @param pyActorClass The Python actor class.
|
||||
* @param args Arguments of the actor constructor.
|
||||
* @param options The options for creating actor. Returns A handle to the actor.
|
||||
* @param options The options for creating actor.
|
||||
* @return A handle to the actor.
|
||||
*/
|
||||
PyActorHandle createActor(PyActorClass pyActorClass, Object[] args, ActorCreationOptions options);
|
||||
|
||||
@@ -170,14 +179,16 @@ public interface RayRuntime {
|
||||
/**
|
||||
* Wrap a {@link Runnable} with necessary context capture.
|
||||
*
|
||||
* @param runnable The runnable to wrap. Returns The wrapped runnable.
|
||||
* @param runnable The runnable to wrap.
|
||||
* @return The wrapped runnable.
|
||||
*/
|
||||
Runnable wrapRunnable(Runnable runnable);
|
||||
|
||||
/**
|
||||
* Wrap a {@link Callable} with necessary context capture.
|
||||
*
|
||||
* @param callable The callable to wrap. Returns The wrapped callable.
|
||||
* @param callable The callable to wrap.
|
||||
* @return The wrapped callable.
|
||||
*/
|
||||
<T> Callable<T> wrapCallable(Callable<T> callable);
|
||||
|
||||
@@ -187,14 +198,15 @@ public interface RayRuntime {
|
||||
/**
|
||||
* Get a placement group by id.
|
||||
*
|
||||
* @param id placement group id. Returns The placement group.
|
||||
* @param id placement group id.
|
||||
* @return The placement group.
|
||||
*/
|
||||
PlacementGroup getPlacementGroup(PlacementGroupId id);
|
||||
|
||||
/**
|
||||
* Get all placement groups in this cluster.
|
||||
*
|
||||
* <p>Returns All placement groups.
|
||||
* @return All placement groups.
|
||||
*/
|
||||
List<PlacementGroup> getAllPlacementGroups();
|
||||
|
||||
@@ -209,8 +221,8 @@ public interface RayRuntime {
|
||||
* Wait for the placement group to be ready within the specified time.
|
||||
*
|
||||
* @param id Id of placement group.
|
||||
* @param timeoutMs Timeout in milliseconds. Returns True if the placement group is created. False
|
||||
* otherwise.
|
||||
* @param timeoutMs Timeout in milliseconds.
|
||||
* @return True if the placement group is created. False otherwise.
|
||||
*/
|
||||
boolean waitPlacementGroupReady(PlacementGroupId id, int timeoutMs);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public interface RuntimeContext {
|
||||
boolean wasCurrentActorRestarted();
|
||||
|
||||
/**
|
||||
* Return true if Ray is running in single-process mode, false if Ray is running in cluster mode.
|
||||
* Returns true if Ray is running in single-process mode, false if Ray is running in cluster mode.
|
||||
*/
|
||||
boolean isSingleProcess();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user