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 |
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,
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) |
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 |
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.
|
String |
toString() |
public static final ResourceProfile UNKNOWN
public static final ResourceProfile ANY
public ResourceProfile(double cpuCores, int heapMemoryInMB, int directMemoryInMB, int nativeMemoryInMB, int networkMemoryInMB, 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.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 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>
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.