@Internal public class ResourceSpec extends Object implements Serializable
The state backend provides the method to estimate memory usages based on state size in the resource.
Resource provides merge(ResourceSpec)
method for chained operators when generating job graph.
Resource provides lessThanOrEqual(ResourceSpec)
method to compare these fields in sequence:
Modifier and Type | Class and Description |
---|---|
static class |
ResourceSpec.Builder
Builder for the
ResourceSpec . |
Modifier and Type | Field and Description |
---|---|
static ResourceSpec |
DEFAULT |
static String |
GPU_NAME |
Modifier | Constructor and Description |
---|---|
protected |
ResourceSpec(double cpuCores,
int heapMemoryInMB,
int directMemoryInMB,
int nativeMemoryInMB,
int stateSizeInMB,
Resource... extendedResources)
Creates a new ResourceSpec with full resources.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
double |
getCpuCores() |
int |
getDirectMemory() |
Map<String,Resource> |
getExtendedResources() |
double |
getGPUResource() |
int |
getHeapMemory() |
int |
getNativeMemory() |
int |
getStateSize() |
int |
hashCode() |
boolean |
isValid()
Check whether all the field values are valid.
|
boolean |
lessThanOrEqual(ResourceSpec other)
Checks the current resource less than or equal with the other resource by comparing
all the fields in the resource.
|
ResourceSpec |
merge(ResourceSpec other)
Used by system internally to merge the other resources of chained operators
when generating the job graph or merge the resource consumed by state backend.
|
static ResourceSpec.Builder |
newBuilder() |
String |
toString() |
public static final ResourceSpec DEFAULT
public static final String GPU_NAME
protected ResourceSpec(double cpuCores, int heapMemoryInMB, int directMemoryInMB, int nativeMemoryInMB, int stateSizeInMB, Resource... extendedResources)
cpuCores
- The number of CPU cores (possibly fractional, i.e., 0.2 cores)heapMemoryInMB
- The size of the java heap memory, in megabytes.directMemoryInMB
- The size of the java nio direct memory, in megabytes.nativeMemoryInMB
- The size of the native memory, in megabytes.stateSizeInMB
- The state size for storing in checkpoint.extendedResources
- The extended resources, associated with the resource manager usedpublic ResourceSpec merge(ResourceSpec other)
other
- Reference to resource to merge in.public double getCpuCores()
public int getHeapMemory()
public int getDirectMemory()
public int getNativeMemory()
public int getStateSize()
public double getGPUResource()
public boolean isValid()
public boolean lessThanOrEqual(@Nonnull ResourceSpec other)
other
- The resource to comparepublic static ResourceSpec.Builder newBuilder()
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.