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 classResourceSpec.BuilderBuilder for theResourceSpec.
-
Field Summary
Fields Modifier and Type Field Description static ResourceSpecDEFAULTThe default ResourceSpec used for operators and transformation functions.static ResourceSpecUNKNOWNA ResourceSpec that indicates an unknown set of resources.static ResourceSpecZEROA ResourceSpec that indicates zero amount of resources.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)CPUResourcegetCpuCores()Optional<ExternalResource>getExtendedResource(String name)Map<String,ExternalResource>getExtendedResources()org.apache.flink.configuration.MemorySizegetManagedMemory()org.apache.flink.configuration.MemorySizegetTaskHeapMemory()org.apache.flink.configuration.MemorySizegetTaskOffHeapMemory()inthashCode()booleanlessThanOrEqual(ResourceSpec other)Checks the current resource less than or equal with the other resource by comparing all the fields in the resource.ResourceSpecmerge(ResourceSpec other)Used by system internally to merge the other resources of chained operators when generating the job graph.static ResourceSpec.BuildernewBuilder(double cpuCores, int taskHeapMemoryMB)static ResourceSpec.BuildernewBuilder(double cpuCores, org.apache.flink.configuration.MemorySize taskHeapMemory)ResourceSpecsubtract(ResourceSpec other)Subtracts another resource spec from this one.StringtoString()
-
-
-
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 org.apache.flink.configuration.MemorySize getTaskHeapMemory()
-
getTaskOffHeapMemory
public org.apache.flink.configuration.MemorySize getTaskOffHeapMemory()
-
getManagedMemory
public org.apache.flink.configuration.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, org.apache.flink.configuration.MemorySize taskHeapMemory)
-
-