Class RunSpecification.Builder

java.lang.Object
co.yellowdog.platform.model.builders.ValidatedBuilder<RunSpecification>
co.yellowdog.platform.model.RunSpecification.Builder
Enclosing class:
RunSpecification

public static class RunSpecification.Builder extends ValidatedBuilder<RunSpecification>
A builder that can be used to build a new RunSpecification that is automatically validated on build.
  • Method Details

    • instanceType

      public RunSpecification.Builder instanceType(@NotBlank @NotBlank String instanceType)
    • instanceTypes

      public RunSpecification.Builder instanceTypes(Collection<? extends @NotBlank String> instanceTypes)
    • clearInstanceTypes

      public RunSpecification.Builder clearInstanceTypes()
    • vcpus

      public RunSpecification.Builder vcpus(DoubleRange vcpus)
      Range constraint on number of vCPUs that are required to execute tasks
      Parameters:
      vcpus - range constraint on required number of vCPUs
      Returns:
      this.
    • ram

      Range constraint on GB of RAM that are required to execute tasks
      Parameters:
      ram - range constraint on GB of RAM
      Returns:
      this.
    • taskType

      public RunSpecification.Builder taskType(@NotBlank @NotBlank String taskType)
    • taskTypes

      public RunSpecification.Builder taskTypes(Collection<? extends @NotBlank String> taskTypes)
    • clearTaskTypes

      public RunSpecification.Builder clearTaskTypes()
    • minWorkers

      public RunSpecification.Builder minWorkers(Integer minWorkers)
      The minimum number of Workers that the associated TaskGroup requires. This many workers must be claimed before the associated TaskGroup will start running.
      Parameters:
      minWorkers - defines the minimum number of Workers required
      Returns:
      this.
    • maxWorkers

      public RunSpecification.Builder maxWorkers(Integer maxWorkers)
      The maximum number of Workers that can be claimed for the associated TaskGroup.
      Parameters:
      maxWorkers - defines the maximum number of Workers that can be claimed
      Returns:
      this.
    • tasksPerWorker

      public RunSpecification.Builder tasksPerWorker(Integer tasksPerWorker)
      Determines the number of worker claims based on splitting the number of unfinished tasks across workers.
      Parameters:
      tasksPerWorker - how many unfinished tasks per worker to determine the number of worker claims
      Returns:
      this.
    • exclusiveWorkers

      public RunSpecification.Builder exclusiveWorkers(Boolean exclusiveWorkers)
      If true, then do not allow claimed Workers to be shared with other task groups; otherwise, Workers can be shared.
      Parameters:
      exclusiveWorkers - if true, then do not allow claimed Workers to be shared with other task groups; otherwise, Workers can be shared
      Returns:
      this.
    • maximumTaskRetries

      public RunSpecification.Builder maximumTaskRetries(int maximumTaskRetries)
      The maximum number of times a task can be retried after it has failed.
      Parameters:
      maximumTaskRetries - the maximum number of times a task can be retried after it has failed
      Returns:
      this.
    • taskTimeout

      public RunSpecification.Builder taskTimeout(Duration taskTimeout)
      The maximum time that a worker should attempt to execute a task for before failing it. NB: This value can be overridden on individual tasks when they are added.
      Parameters:
      taskTimeout - the maximum time that a worker should attempt to execute a task for before failing it
      Returns:
      this.
    • provider

      public RunSpecification.Builder provider(@NotNull @NotNull CloudProvider provider)
    • providers

      public RunSpecification.Builder providers(Collection<? extends @NotNull CloudProvider> providers)
    • clearProviders

      public RunSpecification.Builder clearProviders()
    • region

      public RunSpecification.Builder region(@NotBlank @NotBlank String region)
    • regions

      public RunSpecification.Builder regions(Collection<? extends @NotBlank String> regions)
    • clearRegions

      public RunSpecification.Builder clearRegions()
    • workerTag

      public RunSpecification.Builder workerTag(@NotBlank @Size(max=200) @NotBlank @Size(max=200) String workerTag)
    • workerTags

      public RunSpecification.Builder workerTags(Collection<? extends @NotBlank @Size(max=200) String> workerTags)
    • clearWorkerTags

      public RunSpecification.Builder clearWorkerTags()
    • namespace

      public RunSpecification.Builder namespace(@NotBlank @Namespace @NotBlank @Namespace String namespace)
    • namespaces

      public RunSpecification.Builder namespaces(Collection<? extends @NotBlank @Namespace String> namespaces)
    • clearNamespaces

      public RunSpecification.Builder clearNamespaces()
    • retryableError

      public RunSpecification.Builder retryableError(TaskErrorMatcher retryableError)
    • retryableErrors

      public RunSpecification.Builder retryableErrors(Collection<? extends TaskErrorMatcher> retryableErrors)
    • clearRetryableErrors

      public RunSpecification.Builder clearRetryableErrors()
    • batchAllocation

      public RunSpecification.Builder batchAllocation(Boolean batchAllocation)
      Enables the batch allocation of tasks to nodes. Nodes will maintain local task queues and request batches of tasks as these queues are drained by workers. This can increase throughput for short-running tasks by reducing the latency between a worker completing a task and starting the next one. It can also enable larger numbers of workers to be efficiently utilised by reducing overall load on the YellowDog Scheduler service.
      Parameters:
      batchAllocation - true to enable batch allocation of tasks; otherwise, false, the default, to enable single allocation of tasks
      Returns:
      this.
    • disablePreallocation

      public RunSpecification.Builder disablePreallocation(Boolean disablePreallocation)
      If true, tasks are only allocated to nodes as workers become idle and are not queued on the node.
      Parameters:
      disablePreallocation - true, if tasks are only allocated to nodes as workers become idle; otherwise, false
      Returns:
      this.
    • buildUnchecked

      public RunSpecification buildUnchecked()
      Description copied from class: ValidatedBuilder
      Builds the object without enforcing validation constraints. This should only be used for testing purposes
      Overrides:
      buildUnchecked in class ValidatedBuilder<RunSpecification>
      Returns:
      the object being built
    • toString

      public String toString()
      Overrides:
      toString in class Object