Class JobResourceRequirements
- java.lang.Object
-
- org.apache.flink.runtime.jobgraph.JobResourceRequirements
-
- All Implemented Interfaces:
Serializable
public class JobResourceRequirements extends Object implements Serializable
Information about the parallelism of job vertices.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JobResourceRequirements.Builder
-
Constructor Summary
Constructors Constructor Description JobResourceRequirements(Map<JobVertexID,JobVertexResourceRequirements> vertexResources)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JobResourceRequirements
empty()
boolean
equals(Object o)
Map<JobVertexID,JobVertexResourceRequirements>
getJobVertexParallelisms()
Set<JobVertexID>
getJobVertices()
JobVertexResourceRequirements.Parallelism
getParallelism(JobVertexID jobVertexId)
int
hashCode()
static JobResourceRequirements.Builder
newBuilder()
static Optional<JobResourceRequirements>
readFromJobGraph(JobGraph jobGraph)
Readresource requirements
from the configuration of a givenJobGraph
.String
toString()
static List<String>
validate(JobResourceRequirements jobResourceRequirements, Map<JobVertexID,Integer> maxParallelismPerVertex)
This method validates that: The requested boundaries are less or equal than the max parallelism.static void
writeToJobGraph(JobGraph jobGraph, JobResourceRequirements jobResourceRequirements)
Writeresource requirements
into the configuration of a givenJobGraph
.
-
-
-
Constructor Detail
-
JobResourceRequirements
public JobResourceRequirements(Map<JobVertexID,JobVertexResourceRequirements> vertexResources)
-
-
Method Detail
-
writeToJobGraph
public static void writeToJobGraph(JobGraph jobGraph, JobResourceRequirements jobResourceRequirements) throws IOException
Writeresource requirements
into the configuration of a givenJobGraph
.- Parameters:
jobGraph
- job graph to write requirements tojobResourceRequirements
- resource requirements to write- Throws:
IOException
- in case we're not able to serialize requirements into the configuration
-
readFromJobGraph
public static Optional<JobResourceRequirements> readFromJobGraph(JobGraph jobGraph) throws IOException
Readresource requirements
from the configuration of a givenJobGraph
.- Parameters:
jobGraph
- job graph to read requirements from- Throws:
IOException
- in case we're not able to deserialize requirements from the configuration
-
validate
public static List<String> validate(JobResourceRequirements jobResourceRequirements, Map<JobVertexID,Integer> maxParallelismPerVertex)
This method validates that:- The requested boundaries are less or equal than the max parallelism.
- The requested boundaries are greater than zero.
- The requested upper bound is greater than the lower bound.
- There are no unknown job vertex ids and that we're not missing any.
-1
, it will be expanded to the default value (1
for the lower bound and the max parallelism for the upper bound), before the validation.- Parameters:
jobResourceRequirements
- contains the new resources requirements for the job verticesmaxParallelismPerVertex
- allows us to look up maximum possible parallelism for a job vertex- Returns:
- a list of validation errors
-
empty
public static JobResourceRequirements empty()
-
newBuilder
public static JobResourceRequirements.Builder newBuilder()
-
getParallelism
public JobVertexResourceRequirements.Parallelism getParallelism(JobVertexID jobVertexId)
-
getJobVertices
public Set<JobVertexID> getJobVertices()
-
getJobVertexParallelisms
public Map<JobVertexID,JobVertexResourceRequirements> getJobVertexParallelisms()
-
-