Class RunSpecification

java.lang.Object
co.yellowdog.platform.model.RunSpecification
All Implemented Interfaces:
Serializable

@ValidatedBy(RunSpecificationValidator.class) public class RunSpecification extends Object implements Serializable
Specifies the behaviours to be used by the YellowDog Scheduler when executing Tasks within the associated TaskGroup.
See Also:
  • Method Details

    • builder

      public static RunSpecification.Builder builder()
    • toBuilder

      public RunSpecification.Builder toBuilder()
    • getInstanceTypes

      public List<@NotBlank String> getInstanceTypes()
      The machine instance types that can be used to execute tasks
      Returns:
      the machine instance types that can be used to execute tasks
    • getInstancePricingPreference

      public InstancePricingPreference getInstancePricingPreference()
      The preferred InstancePricing of the machine instances to use.
      Returns:
      the preferred InstancePricing of the machine instances to use
    • getVcpus

      public DoubleRange getVcpus()
      Range constraint on number of vCPUs that are required to execute tasks
      Returns:
      range constraint on required number of vCPUs
    • getRam

      public DoubleRange getRam()
      Range constraint on GB of RAM that are required to execute tasks
      Returns:
      range constraint on GB of RAM
    • getTaskTypes

      public List<@NotBlank String> getTaskTypes()
      The task types that will be used in the associated TaskGroup.
      Returns:
      the task types that will be used
    • getMinWorkers

      public Integer getMinWorkers()
      The minimum number of Workers that the YellowDog Scheduler aims to keep claimed for the associated TaskGroup while it is TaskGroupStatus.RUNNING. This does not delay the TaskGroup starting, and is no longer applied once the TaskGroup is TaskGroupStatus.FINISHING.
      Returns:
      defines the minimum number of Workers required
    • getMaxWorkers

      public Integer getMaxWorkers()
      The maximum number of Workers that can be claimed for the associated TaskGroup.
      Returns:
      defines the maximum number of Workers that can be claimed
    • getTasksPerWorker

      public Integer getTasksPerWorker()
      Determines the number of worker claims based on splitting the number of unfinished tasks across workers. This is only used until the YellowDog Scheduler has estimated how long the associated TaskGroup's tasks take, after which claims are sized from that estimate instead.
      Returns:
      how many unfinished tasks per worker to determine the number of worker claims
    • getMaximumTaskRetries

      @Deprecated public Integer getMaximumTaskRetries()
      Deprecated.
      Use retryPolicy instead
      The maximum number of times a task can be retried after it has failed.

      To restrict which tasks can be retried based on the last error that was encountered, see retryableErrors

      Returns:
      the maximum number of times a task can be retried after it has failed
    • getTaskTimeout

      public Duration getTaskTimeout()
      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.
      Returns:
      the maximum time that a worker should attempt to execute a task for before failing it
    • getProviders

      public List<@NotNull CloudProvider> getProviders()
      Constrains the YellowDog Scheduler to only execute tasks from the associated TaskGroup on the specified providers.
      Returns:
      the providers on which tasks can be executed
    • getRegions

      public List<@NotBlank String> getRegions()
      Constrains the YellowDog Scheduler to only execute tasks from the associated TaskGroup in the specified regions.
      Returns:
      the regions in which tasks can be executed
    • getWorkerTags

      public List<@NotBlank @Size(max=200) String> getWorkerTags()
      Constrains the YellowDog Scheduler to only execute tasks from the associated TaskGroup on workers with a matching tag value.
      Returns:
      the tag values that constrain an allowed workers' tag
    • getNamespaces

      public List<@NotBlank @Namespace String> getNamespaces()
      Constrains the YellowDog Scheduler to only execute tasks from the associated TaskGroup on nodes from worker pools in the specified namespaces.
      Returns:
      the namespaces
    • getRetryableErrors

      @Deprecated public List<TaskErrorMatcher> getRetryableErrors()
      Deprecated.
      Use retryPolicy instead
      Defines the errors that should result in a task retrying if encountered.
      Returns:
      the list of task error matchers
    • getDisablePreallocation

      public Boolean getDisablePreallocation()
      If true, tasks are only allocated to nodes as workers become idle and are not queued on the node.
      Returns:
      true, if tasks are only allocated to nodes as workers become idle; otherwise, false
    • getRetryPolicy

      public RetryPolicy getRetryPolicy()
      A RetryPolicy for Tasks. This must not be used in combination with the deprecated retryableErrors or maximumTaskRetries.
      Returns:
      Policy describing how Tasks should be retried, will be null if Tasks should not be retried using theRetryPolicy
    • getFailurePolicy

      public FailurePolicy getFailurePolicy()
      An optional FailurePolicy for Tasks.
      Returns:
      Policy describing what to do when a Task fails, will be null if no further actions should be taken.
    • setInstanceTypes

      public void setInstanceTypes(List<@NotBlank String> instanceTypes)
      The machine instance types that can be used to execute tasks
      Parameters:
      instanceTypes - the machine instance types that can be used to execute tasks
    • setInstancePricingPreference

      public void setInstancePricingPreference(InstancePricingPreference instancePricingPreference)
      The preferred InstancePricing of the machine instances to use.
      Parameters:
      instancePricingPreference - the preferred InstancePricing of the machine instances to use
    • setVcpus

      public void setVcpus(DoubleRange vcpus)
      Range constraint on number of vCPUs that are required to execute tasks
      Parameters:
      vcpus - range constraint on required number of vCPUs
    • setRam

      public void setRam(DoubleRange ram)
      Range constraint on GB of RAM that are required to execute tasks
      Parameters:
      ram - range constraint on GB of RAM
    • setTaskTypes

      public void setTaskTypes(List<@NotBlank String> taskTypes)
      The task types that will be used in the associated TaskGroup.
      Parameters:
      taskTypes - the task types that will be used
    • setMinWorkers

      public void setMinWorkers(Integer minWorkers)
      The minimum number of Workers that the YellowDog Scheduler aims to keep claimed for the associated TaskGroup while it is TaskGroupStatus.RUNNING. This does not delay the TaskGroup starting, and is no longer applied once the TaskGroup is TaskGroupStatus.FINISHING.
      Parameters:
      minWorkers - defines the minimum number of Workers required
    • setMaxWorkers

      public void setMaxWorkers(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
    • setTasksPerWorker

      public void setTasksPerWorker(Integer tasksPerWorker)
      Determines the number of worker claims based on splitting the number of unfinished tasks across workers. This is only used until the YellowDog Scheduler has estimated how long the associated TaskGroup's tasks take, after which claims are sized from that estimate instead.
      Parameters:
      tasksPerWorker - how many unfinished tasks per worker to determine the number of worker claims
    • setMaximumTaskRetries

      @Deprecated public void setMaximumTaskRetries(Integer maximumTaskRetries)
      Deprecated.
      Use retryPolicy instead
      The maximum number of times a task can be retried after it has failed.

      To restrict which tasks can be retried based on the last error that was encountered, see retryableErrors

      Parameters:
      maximumTaskRetries - the maximum number of times a task can be retried after it has failed
    • setTaskTimeout

      public void setTaskTimeout(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
    • setProviders

      public void setProviders(List<@NotNull CloudProvider> providers)
      Constrains the YellowDog Scheduler to only execute tasks from the associated TaskGroup on the specified providers.
      Parameters:
      providers - the providers on which tasks can be executed
    • setRegions

      public void setRegions(List<@NotBlank String> regions)
      Constrains the YellowDog Scheduler to only execute tasks from the associated TaskGroup in the specified regions.
      Parameters:
      regions - the regions in which tasks can be executed
    • setWorkerTags

      public void setWorkerTags(List<@NotBlank @Size(max=200) String> workerTags)
      Constrains the YellowDog Scheduler to only execute tasks from the associated TaskGroup on workers with a matching tag value.
      Parameters:
      workerTags - the tag values that constrain an allowed workers' tags
    • setNamespaces

      public void setNamespaces(List<@NotBlank @Namespace String> namespaces)
      Constrains the YellowDog Scheduler to only execute tasks from the associated TaskGroup on nodes from worker pools in the specified namespaces.
      Parameters:
      namespaces - the namespaces
    • setRetryableErrors

      @Deprecated public void setRetryableErrors(List<TaskErrorMatcher> retryableErrors)
      Deprecated.
      Use retryPolicy instead
      Defines the errors that should result in a task retrying if encountered.
      Parameters:
      retryableErrors - the list of task error matchers
    • setDisablePreallocation

      public void setDisablePreallocation(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
    • setRetryPolicy

      public void setRetryPolicy(RetryPolicy retryPolicy)
      A RetryPolicy for Tasks. This must not be used in combination with the deprecated retryableErrors or maximumTaskRetries.
      Parameters:
      retryPolicy - Policy describing how Tasks should be retried, can be null if Tasks should not be retried using the RetryPolicy
    • setFailurePolicy

      public void setFailurePolicy(FailurePolicy failurePolicy)
      An optional FailurePolicy for Tasks.
      Parameters:
      failurePolicy - policy describing what to do when a Task fails, can be null if no further actions should be taken.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object