Class ResourceAllocation

java.lang.Object
com.pervasive.datarush.cal.ResourceAllocation
All Implemented Interfaces:
Serializable

public final class ResourceAllocation extends Object implements Serializable
Describes the resource allocation for a job server process. This indicates:
  • the number of virtual cores allotted
  • the amount of memory (in MB) allotted
See Also:
  • Field Details

  • Constructor Details

    • ResourceAllocation

      public ResourceAllocation(int cpus, int memory)
  • Method Details

    • getCPU

      public int getCPU()
      Gets the number of virtual cores allotted.
      Returns:
      the allocated CPU
    • getMemory

      public int getMemory()
      Gets the memory, in MB, allotted.
      Returns:
      the allocated memory
    • forWorker

      public ResourceAllocation forWorker(int partitions)
      Computes the resource allotment for a worker process. The original allocation is taken to represent a per-partition allotment, with the result being the total allotment for the worker handling those partitions.
      Parameters:
      partitions - the number of partitions handled by the worker
      Returns:
      the worker's resource allocation
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • add

    • subtract

      public ResourceAllocation subtract(ResourceAllocation usage)
    • calculatePartitions

      public int calculatePartitions(ResourceAllocation usage)
      Computes the number of partitions of the specified usage within the allocation.
      Parameters:
      usage - the per-partition resource allotment
      Returns:
      the number of partitions fitting in this allocation
    • calculateDominantUsage

      public double calculateDominantUsage(ResourceAllocation usage)
      Computes the dominant share of resources for the specified usage relative to this allocation. This is the maximum percentage of total capacity used per resource type.
      Parameters:
      usage - resource usage for which to compute share
      Returns:
      the fraction of total capacity for the most used resource.
    • contains

      public boolean contains(ResourceAllocation other)
    • asPortion

      public String asPortion(ResourceAllocation usage)