public interface RayRuntime
| Modifier and Type | Method and Description |
|---|---|
ObjectRef |
call(PyFunction pyFunction,
Object[] args,
CallOptions options)
Invoke a remote Python function.
|
ObjectRef |
call(RayFunc func,
Object[] args,
CallOptions options)
Invoke a remote function.
|
ObjectRef |
callActor(ActorHandle<?> actor,
RayFunc func,
Object[] args)
Invoke a remote function on an actor.
|
ObjectRef |
callActor(PyActorHandle pyActor,
PyActorMethod pyActorMethod,
Object[] args)
Invoke a remote Python function on an actor.
|
PyActorHandle |
createActor(PyActorClass pyActorClass,
Object[] args,
ActorCreationOptions options)
Create a Python actor on a remote node.
|
<T> ActorHandle<T> |
createActor(RayFunc actorFactoryFunc,
Object[] args,
ActorCreationOptions options)
Create an actor on a remote node.
|
PlacementGroup |
createPlacementGroup(List<Map<String,Double>> bundles,
PlacementStrategy strategy) |
void |
exitActor()
Intentionally exit the current actor.
|
void |
free(List<ObjectRef<?>> objectRefs,
boolean localOnly,
boolean deleteCreatingTasks)
Free a list of objects from Plasma Store.
|
<T> List<T> |
get(List<ObjectRef<T>> objectRefs)
Get a list of objects from the object store.
|
<T> T |
get(ObjectRef<T> objectRef)
Get an object from the object store.
|
<T extends BaseActorHandle> |
getActor(String name,
boolean global)
Get a handle to a named actor.
|
<T extends BaseActorHandle> |
getActorHandle(ActorId actorId) |
Object |
getAsyncContext() |
RuntimeContext |
getRuntimeContext() |
void |
killActor(BaseActorHandle actor,
boolean noRestart)
Kill the actor immediately.
|
<T> ObjectRef<T> |
put(T obj)
Store an object in the object store.
|
void |
setAsyncContext(Object asyncContext) |
void |
setResource(String resourceName,
double capacity,
UniqueId nodeId)
Set the resource for the specific node.
|
void |
shutdown()
Shutdown the runtime.
|
<T> WaitResult<T> |
wait(List<ObjectRef<T>> waitList,
int numReturns,
int timeoutMs)
Wait for a list of RayObjects to be locally available, until specified number of objects are
ready, or specified timeout has passed.
|
<T> Callable<T> |
wrapCallable(Callable<T> callable)
Wrap a
Callable with necessary context capture. |
Runnable |
wrapRunnable(Runnable runnable)
Wrap a
Runnable with necessary context capture. |
void shutdown()
<T> ObjectRef<T> put(T obj)
obj - The Java object to be stored.<T> T get(ObjectRef<T> objectRef)
objectRef - The reference of the object to get.<T> List<T> get(List<ObjectRef<T>> objectRefs)
objectRefs - The list of object references.<T> WaitResult<T> wait(List<ObjectRef<T>> waitList, int numReturns, int timeoutMs)
waitList - A list of ObjectRef to wait for.numReturns - The number of objects that should be returned.timeoutMs - The maximum time in milliseconds to wait before returning.void free(List<ObjectRef<?>> objectRefs, boolean localOnly, boolean deleteCreatingTasks)
objectRefs - The object references to free.localOnly - Whether only free objects for local object store or not.deleteCreatingTasks - Whether also delete objects' creating tasks from GCS.void setResource(String resourceName, double capacity, UniqueId nodeId)
resourceName - The name of resource.capacity - The capacity of the resource.nodeId - The node that we want to set its resource.<T extends BaseActorHandle> T getActorHandle(ActorId actorId)
<T extends BaseActorHandle> Optional<T> getActor(String name, boolean global)
Gets a handle to a named actor with the given name. The actor must have been created with name specified.
name - The name of the named actor.global - Whether the named actor is global.void killActor(BaseActorHandle actor, boolean noRestart)
actor - The actor to be killed.noRestart - If set to true, the killed actor will not be restarted anymore.ObjectRef call(RayFunc func, Object[] args, CallOptions options)
func - The remote function to run.args - The arguments of the remote function.options - The options for this call.ObjectRef call(PyFunction pyFunction, Object[] args, CallOptions options)
pyFunction - The Python function.args - Arguments of the function.options - The options for this call.ObjectRef callActor(ActorHandle<?> actor, RayFunc func, Object[] args)
actor - A handle to the actor.func - The remote function to run, it must be a method of the given actor.args - The arguments of the remote function.ObjectRef callActor(PyActorHandle pyActor, PyActorMethod pyActorMethod, Object[] args)
pyActor - A handle to the actor.pyActorMethod - The actor method.args - Arguments of the function.<T> ActorHandle<T> createActor(RayFunc actorFactoryFunc, Object[] args, ActorCreationOptions options)
T - The type of the actor object.actorFactoryFunc - A remote function whose return value is the actor object.args - The arguments for the remote function.options - The options for creating actor.PyActorHandle createActor(PyActorClass pyActorClass, Object[] args, ActorCreationOptions options)
pyActorClass - The Python actor class.args - Arguments of the actor constructor.options - The options for creating actor.PlacementGroup createPlacementGroup(List<Map<String,Double>> bundles, PlacementStrategy strategy)
RuntimeContext getRuntimeContext()
Object getAsyncContext()
void setAsyncContext(Object asyncContext)
Runnable wrapRunnable(Runnable runnable)
Runnable with necessary context capture.runnable - The runnable to wrap.<T> Callable<T> wrapCallable(Callable<T> callable)
Callable with necessary context capture.callable - The callable to wrap.void exitActor()
Copyright © 2020. All rights reserved.