Class ResourceSpec
- java.lang.Object
-
- org.apache.flink.api.common.operators.ResourceSpec
-
- All Implemented Interfaces:
Serializable
@Internal public final class ResourceSpec extends Object implements Serializable
Describe the different resource factors of the operator with UDF.Resource provides
merge(ResourceSpec)
method for chained operators when generating job graph.Resource provides
lessThanOrEqual(ResourceSpec)
method to compare these fields in sequence:- CPU cores
- Task Heap Memory
- Task Off-Heap Memory
- Managed Memory
- Extended resources
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ResourceSpec.Builder
Builder for theResourceSpec
.
-
Field Summary
Fields Modifier and Type Field Description static ResourceSpec
DEFAULT
The default ResourceSpec used for operators and transformation functions.static ResourceSpec
UNKNOWN
A ResourceSpec that indicates an unknown set of resources.static ResourceSpec
ZERO
A ResourceSpec that indicates zero amount of resources.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
CPUResource
getCpuCores()
Optional<ExternalResource>
getExtendedResource(String name)
Map<String,ExternalResource>
getExtendedResources()
MemorySize
getManagedMemory()
MemorySize
getTaskHeapMemory()
MemorySize
getTaskOffHeapMemory()
int
hashCode()
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.static ResourceSpec.Builder
newBuilder(double cpuCores, int taskHeapMemoryMB)
static ResourceSpec.Builder
newBuilder(double cpuCores, MemorySize taskHeapMemory)
ResourceSpec
subtract(ResourceSpec other)
Subtracts another resource spec from this one.String
toString()
-
-
-
Field Detail
-
UNKNOWN
public static final ResourceSpec UNKNOWN
A ResourceSpec that indicates an unknown set of resources.
-
DEFAULT
public static final ResourceSpec DEFAULT
The default ResourceSpec used for operators and transformation functions. Currently equal toUNKNOWN
.
-
ZERO
public static final ResourceSpec ZERO
A ResourceSpec that indicates zero amount of resources.
-
-
Method Detail
-
merge
public ResourceSpec merge(ResourceSpec other)
Used by system internally to merge the other resources of chained operators when generating the job graph.- Parameters:
other
- Reference to resource to merge in.- Returns:
- The new resource with merged values.
-
subtract
public ResourceSpec subtract(ResourceSpec other)
Subtracts another resource spec from this one.- Parameters:
other
- The other resource spec to subtract.- Returns:
- The subtracted resource spec.
-
getCpuCores
public CPUResource getCpuCores()
-
getTaskHeapMemory
public MemorySize getTaskHeapMemory()
-
getTaskOffHeapMemory
public MemorySize getTaskOffHeapMemory()
-
getManagedMemory
public MemorySize getManagedMemory()
-
getExtendedResource
public Optional<ExternalResource> getExtendedResource(String name)
-
getExtendedResources
public Map<String,ExternalResource> getExtendedResources()
-
lessThanOrEqual
public boolean lessThanOrEqual(ResourceSpec other)
Checks the current resource less than or equal with the other resource by comparing all the fields in the resource.- Parameters:
other
- The resource to compare- Returns:
- True if current resource is less than or equal with the other resource, otherwise return false.
-
newBuilder
public static ResourceSpec.Builder newBuilder(double cpuCores, int taskHeapMemoryMB)
-
newBuilder
public static ResourceSpec.Builder newBuilder(double cpuCores, MemorySize taskHeapMemory)
-
-