java.lang.Object
com.pervasive.datarush.cal.ResourceAllocation
- All Implemented Interfaces:
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final ResourceAllocationstatic final ResourceAllocationstatic final ResourceAllocation -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(ResourceAllocation other) asPortion(ResourceAllocation usage) doubleComputes the dominant share of resources for the specified usage relative to this allocation.intComputes the number of partitions of the specified usage within the allocation.booleancontains(ResourceAllocation other) forWorker(int partitions) Computes the resource allotment for a worker process.intgetCPU()Gets the number of virtual cores allotted.intGets the memory, in MB, allotted.subtract(ResourceAllocation usage) toString()
-
Field Details
-
NONE
-
MASTER_DEFAULT
-
PARTITION_DEFAULT
-
-
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
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
-
add
-
subtract
-
calculatePartitions
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
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
-
asPortion
-