public final class ResourceAllocation extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static ResourceAllocation |
MASTER_DEFAULT |
static ResourceAllocation |
NONE |
static ResourceAllocation |
PARTITION_DEFAULT |
Constructor and Description |
---|
ResourceAllocation(int cpus,
int memory) |
Modifier and Type | Method and Description |
---|---|
ResourceAllocation |
add(ResourceAllocation other) |
String |
asPortion(ResourceAllocation usage) |
double |
calculateDominantUsage(ResourceAllocation usage)
Computes the dominant share of resources for the specified usage
relative to this allocation.
|
int |
calculatePartitions(ResourceAllocation usage)
Computes the number of partitions of the specified usage within the
allocation.
|
boolean |
contains(ResourceAllocation other) |
ResourceAllocation |
forWorker(int partitions)
Computes the resource allotment for a worker process.
|
int |
getCPU()
Gets the number of virtual cores allotted.
|
int |
getMemory()
Gets the memory, in MB, allotted.
|
ResourceAllocation |
subtract(ResourceAllocation usage) |
String |
toString() |
public static final ResourceAllocation NONE
public static final ResourceAllocation MASTER_DEFAULT
public static final ResourceAllocation PARTITION_DEFAULT
public int getCPU()
public int getMemory()
public ResourceAllocation forWorker(int partitions)
partitions
- the number of partitions handled by the workerpublic ResourceAllocation add(ResourceAllocation other)
public ResourceAllocation subtract(ResourceAllocation usage)
public int calculatePartitions(ResourceAllocation usage)
usage
- the per-partition resource allotmentpublic double calculateDominantUsage(ResourceAllocation usage)
usage
- resource usage for which to compute sharepublic boolean contains(ResourceAllocation other)
public String asPortion(ResourceAllocation usage)
Copyright © 2024 Actian Corporation. All rights reserved.