public class ResourceProfile extends Object implements Serializable, Comparable<ResourceProfile>
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 | Field and Description |
---|---|
static ResourceProfile |
ANY
ResourceProfile which matches any other ResourceProfile.
|
static ResourceProfile |
UNKNOWN
A ResourceProfile that indicates an unknown set of resources.
|
static ResourceProfile |
ZERO
A ResourceProfile describing zero resources.
|
Constructor and Description |
---|
ResourceProfile(double cpuCores,
int heapMemoryInMB)
Creates a new simple ResourceProfile used for testing.
|
ResourceProfile(double cpuCores,
int heapMemoryInMB,
int directMemoryInMB,
int nativeMemoryInMB,
int networkMemoryInMB,
int managedMemoryInMB,
Map<String,Resource> extendedResources)
Creates a new ResourceProfile.
|
ResourceProfile(ResourceProfile other)
Creates a copy of the given ResourceProfile.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(ResourceProfile other) |
boolean |
equals(Object obj) |
static ResourceProfile |
fromResourceSpec(ResourceSpec resourceSpec,
int networkMemory) |
double |
getCpuCores()
Get the cpu cores needed.
|
int |
getDirectMemoryInMB()
Get the direct memory needed in MB.
|
Map<String,Resource> |
getExtendedResources()
Get the extended resources.
|
int |
getHeapMemoryInMB()
Get the heap memory needed in MB.
|
int |
getManagedMemoryInMB()
Get the managed memory needed in MB.
|
int |
getMemoryInMB()
Get the total memory needed in MB.
|
int |
getNativeMemoryInMB()
Get the native memory needed in MB.
|
int |
getNetworkMemoryInMB()
Get the memory needed for task to communicate with its upstreams and downstreams in MB.
|
int |
getOperatorsMemoryInMB()
Get the memory the operators needed in MB.
|
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 |
subtract(ResourceProfile other)
Subtracts another piece of resource profile from this one.
|
String |
toString() |
public static final ResourceProfile UNKNOWN
public static final ResourceProfile ANY
public static final ResourceProfile ZERO
public ResourceProfile(double cpuCores, int heapMemoryInMB, int directMemoryInMB, int nativeMemoryInMB, int networkMemoryInMB, int managedMemoryInMB, Map<String,Resource> extendedResources)
cpuCores
- The number of CPU cores (possibly fractional, i.e., 0.2 cores)heapMemoryInMB
- The size of the heap memory, in megabytes.directMemoryInMB
- The size of the direct memory, in megabytes.nativeMemoryInMB
- The size of the native memory, in megabytes.networkMemoryInMB
- The size of the memory for input and output, in megabytes.managedMemoryInMB
- The size of managed memory, in megabytes.extendedResources
- The extended resources such as GPU and FPGApublic ResourceProfile(double cpuCores, int heapMemoryInMB)
cpuCores
- The number of CPU cores (possibly fractional, i.e., 0.2 cores)heapMemoryInMB
- The size of the heap memory, in megabytes.public ResourceProfile(ResourceProfile other)
other
- The ResourceProfile to copy.public double getCpuCores()
public int getHeapMemoryInMB()
public int getDirectMemoryInMB()
public int getNativeMemoryInMB()
public int getNetworkMemoryInMB()
public int getManagedMemoryInMB()
public int getMemoryInMB()
public int getOperatorsMemoryInMB()
public Map<String,Resource> getExtendedResources()
public boolean isMatching(ResourceProfile required)
required
- the required resource profilepublic int compareTo(@Nonnull ResourceProfile other)
compareTo
in interface Comparable<ResourceProfile>
@Nonnull public ResourceProfile merge(@Nonnull ResourceProfile other)
other
- The other resource profile to add.public ResourceProfile subtract(ResourceProfile other)
other
- The other resource profile to subtract.public static ResourceProfile fromResourceSpec(ResourceSpec resourceSpec, int networkMemory)
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.