Class ActorCreationOptions.Builder

java.lang.Object
io.ray.api.options.ActorCreationOptions.Builder
Enclosing class:
ActorCreationOptions

public static class ActorCreationOptions.Builder extends Object
The inner class for building ActorCreationOptions.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • setName

      public ActorCreationOptions.Builder setName(String name)
      Set the actor name of a named actor. This named actor is accessible in this namespace by this name via Ray.getActor(java.lang.String) and in other namespaces via Ray.getActor(java.lang.String, java.lang.String).
      Parameters:
      name - The name of the named actor.
      Returns:
      self
    • setLifetime

      public ActorCreationOptions.Builder setLifetime(ActorLifetime lifetime)
      Declare the lifetime of this actor.
    • setResource

      public ActorCreationOptions.Builder setResource(String resourceName, Double resourceQuantity)
      Set a custom resource requirement to reserve for the lifetime of this actor. This method can be called multiple times. If the same resource is set multiple times, the latest quantity will be used.
      Parameters:
      resourceName - resource name
      resourceQuantity - resource quantity
      Returns:
      self
    • setResources

      public ActorCreationOptions.Builder setResources(Map<String,​Double> resources)
      Set custom resource requirements to reserve for the lifetime of this actor. This method can be called multiple times. If the same resource is set multiple times, the latest quantity will be used.
      Parameters:
      resources - requirements for multiple resources.
      Returns:
      self
    • setMaxRestarts

      public ActorCreationOptions.Builder setMaxRestarts(int maxRestarts)
      This specifies the maximum number of times that the actor should be restarted when it dies 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.
      Parameters:
      maxRestarts - max number of actor restarts
      Returns:
      self
    • setJvmOptions

      public ActorCreationOptions.Builder setJvmOptions(List<String> jvmOptions)
      Set the JVM options for the Java worker that this actor is running in.

      Note, if this is set, this actor won't share Java worker with other actors or tasks.

      Parameters:
      jvmOptions - JVM options for the Java worker that this actor is running in.
      Returns:
      self
    • setMaxConcurrency

      public ActorCreationOptions.Builder setMaxConcurrency(int maxConcurrency)
      Set the max number of concurrent calls to allow for this actor.

      The max concurrency defaults to 1 for threaded execution. Note that the execution order is not guaranteed when max_concurrency > 1.

      Parameters:
      maxConcurrency - The max number of concurrent calls to allow for this actor.
      Returns:
      self
    • setMaxPendingCalls

      public ActorCreationOptions.Builder setMaxPendingCalls(int maxPendingCalls)
      Set the max number of pending calls allowed on the actor handle. When this value is exceeded, ray.exceptions.PendingCallsLimitExceededException will be thrown for further tasks. Note that this limit is counted per handle. -1 means that the number of pending calls is unlimited.
      Parameters:
      maxPendingCalls - The maximum number of pending calls for this actor.
      Returns:
      self
    • setPlacementGroup

      public ActorCreationOptions.Builder setPlacementGroup(PlacementGroup group, int bundleIndex)
      Set the placement group to place this actor in.
      Parameters:
      group - The placement group of the actor.
      bundleIndex - The index of the bundle to place this actor in.
      Returns:
      self
    • build

      public ActorCreationOptions build()
    • setConcurrencyGroups

      public ActorCreationOptions.Builder setConcurrencyGroups(List<ConcurrencyGroup> concurrencyGroups)
      Set the concurrency groups for this actor.
    • setRuntimeEnv

      public ActorCreationOptions.Builder setRuntimeEnv(RuntimeEnv runtimeEnv)