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.
|
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 |
allFieldsNoLessThan(ResourceProfile other)
Check whether all fields of this resource profile are no less than the given resource
profile.
|
boolean |
equals(Object obj) |
static ResourceProfile |
fromResources(double cpuCores,
int taskHeapMemoryMB) |
static ResourceProfile |
fromResourceSpec(ResourceSpec resourceSpec,
MemorySize networkMemory) |
CPUResource |
getCpuCores()
Get the cpu cores needed.
|
Map<String,ExternalResource> |
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() |
static ResourceProfile.Builder |
newBuilder(ResourceProfile resourceProfile) |
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 CPUResource getCpuCores()
public MemorySize getTaskHeapMemory()
public MemorySize getTaskOffHeapMemory()
public MemorySize getManagedMemory()
public MemorySize getNetworkMemory()
public MemorySize getTotalMemory()
public MemorySize getOperatorsMemory()
public Map<String,ExternalResource> getExtendedResources()
public boolean isMatching(ResourceProfile required)
required
- the required resource profilepublic boolean allFieldsNoLessThan(ResourceProfile other)
It is not same with the total resource comparison. It return true iff each resource field(cpu, task heap memory, managed memory, etc.) is no less than the respective field of the given profile.
For example, assume that this profile has 1 core, 50 managed memory and 100 heap memory.
other
- the other 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()
public static ResourceProfile.Builder newBuilder(ResourceProfile resourceProfile)
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.