public class ResourceProfile extends Object implements Serializable
ResourceSpec
with the input and output
memory calculated in JobMaster.
Resource Profiles have a total ordering, defined by comparing these fields in sequence:
Modifier and Type | Class and Description |
---|---|
static class |
ResourceProfile.Builder
Builder for the
ResourceProfile . |
Modifier and Type | Field and Description |
---|---|
static ResourceProfile |
ANY
A ResourceProfile that indicates infinite resource that matches any resource requirement, for
testability purpose only.
|
static ResourceProfile |
UNKNOWN
A ResourceProfile that indicates an unknown resource requirement.
|
static ResourceProfile |
ZERO
A ResourceProfile describing zero resources.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
static ResourceProfile |
fromResources(double cpuCores,
int taskHeapMemoryMB) |
static ResourceProfile |
fromResourceSpec(ResourceSpec resourceSpec,
MemorySize networkMemory) |
Resource |
getCpuCores()
Get the cpu cores needed.
|
Map<String,Resource> |
getExtendedResources()
Get the extended resources.
|
MemorySize |
getManagedMemory()
Get the managed memory needed.
|
MemorySize |
getNetworkMemory()
Get the network memory needed.
|
MemorySize |
getOperatorsMemory()
Get the memory the operators needed.
|
MemorySize |
getTaskHeapMemory()
Get the task heap memory needed.
|
MemorySize |
getTaskOffHeapMemory()
Get the task off-heap memory needed.
|
MemorySize |
getTotalMemory()
Get the total memory needed.
|
int |
hashCode() |
boolean |
isMatching(ResourceProfile required)
Check whether required resource profile can be matched.
|
ResourceProfile |
merge(ResourceProfile other)
Calculates the sum of two resource profiles.
|
ResourceProfile |
multiply(int multiplier) |
static ResourceProfile.Builder |
newBuilder() |
ResourceProfile |
subtract(ResourceProfile other)
Subtracts another piece of resource profile from this one.
|
String |
toString() |
public static final ResourceProfile UNKNOWN
@VisibleForTesting public static final ResourceProfile ANY
public static final ResourceProfile ZERO
public Resource getCpuCores()
public MemorySize getTaskHeapMemory()
public MemorySize getTaskOffHeapMemory()
public MemorySize getManagedMemory()
public MemorySize getNetworkMemory()
public MemorySize getTotalMemory()
public MemorySize getOperatorsMemory()
public Map<String,Resource> getExtendedResources()
public boolean isMatching(ResourceProfile required)
required
- the required resource profile@Nonnull public ResourceProfile merge(ResourceProfile other)
other
- The other resource profile to add.public ResourceProfile subtract(ResourceProfile other)
other
- The other resource profile to subtract.@Nonnull public ResourceProfile multiply(int multiplier)
public static ResourceProfile fromResourceSpec(ResourceSpec resourceSpec, MemorySize networkMemory)
@VisibleForTesting public static ResourceProfile fromResources(double cpuCores, int taskHeapMemoryMB)
public static ResourceProfile.Builder newBuilder()
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.