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 classJobResourceRequirements.Builder
-
Constructor Summary
Constructors Constructor Description JobResourceRequirements(Map<JobVertexID,JobVertexResourceRequirements> vertexResources)
-
Method Summary
-
-
-
Constructor Detail
-
JobResourceRequirements
public JobResourceRequirements(Map<JobVertexID,JobVertexResourceRequirements> vertexResources)
-
-
Method Detail
-
writeToExecutionPlan
public static void writeToExecutionPlan(ExecutionPlan executionPlan, JobResourceRequirements jobResourceRequirements) throws IOException
Writeresource requirementsinto the configuration of a givenExecutionPlan.- Parameters:
executionPlan- executionPlan to write requirements tojobResourceRequirements- resource requirements to write- Throws:
IOException- in case we're not able to serialize requirements into the configuration
-
readFromExecutionPlan
public static Optional<JobResourceRequirements> readFromExecutionPlan(ExecutionPlan executionPlan) throws IOException
Readresource requirementsfrom the configuration of a givenExecutionPlan.- Parameters:
executionPlan- execution plan 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 (1for 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()
-
-