Search in sources :

Example 6 with DistributionPattern

use of org.apache.flink.runtime.jobgraph.DistributionPattern in project flink by apache.

the class DefaultCheckpointPlanCalculator method someTasksMustBeTriggered.

private boolean someTasksMustBeTriggered(Map<JobVertexID, BitSet> runningTasksByVertex, List<JobEdge> prevJobEdges) {
    for (JobEdge jobEdge : prevJobEdges) {
        DistributionPattern distributionPattern = jobEdge.getDistributionPattern();
        BitSet upstreamRunningStatus = runningTasksByVertex.get(jobEdge.getSource().getProducer().getID());
        if (hasActiveUpstreamVertex(distributionPattern, upstreamRunningStatus)) {
            return false;
        }
    }
    return true;
}
Also used : JobEdge(org.apache.flink.runtime.jobgraph.JobEdge) DistributionPattern(org.apache.flink.runtime.jobgraph.DistributionPattern) BitSet(java.util.BitSet)

Example 7 with DistributionPattern

use of org.apache.flink.runtime.jobgraph.DistributionPattern in project flink by apache.

the class VertexFinishedStateChecker method checkPredecessorsOfPartiallyFinishedVertex.

private void checkPredecessorsOfPartiallyFinishedVertex(ExecutionJobVertex vertex, VerticesFinishedStatusCache verticesFinishedStatusCache) {
    // Computes the distribution pattern from each predecessor. If there are multiple edges
    // from a single predecessor, ALL_TO_ALL edges would have a higher priority since it
    // implies stricter limitation (must be fully finished).
    Map<JobVertexID, DistributionPattern> predecessorDistribution = new HashMap<>();
    for (JobEdge jobEdge : vertex.getJobVertex().getInputs()) {
        predecessorDistribution.compute(jobEdge.getSource().getProducer().getID(), (k, v) -> v == DistributionPattern.ALL_TO_ALL ? v : jobEdge.getDistributionPattern());
    }
    for (IntermediateResult dataset : vertex.getInputs()) {
        ExecutionJobVertex predecessor = dataset.getProducer();
        VertexFinishedState predecessorState = verticesFinishedStatusCache.getOrUpdate(predecessor);
        DistributionPattern distribution = predecessorDistribution.get(predecessor.getJobVertexId());
        if (distribution == DistributionPattern.ALL_TO_ALL && predecessorState != VertexFinishedState.FULLY_FINISHED) {
            throw new FlinkRuntimeException("Illegal JobGraph modification. Cannot run a program with partially finished" + " vertices predeceased with running or partially finished ones and" + " connected via the ALL_TO_ALL edges. Task vertex " + vertex.getName() + "(" + vertex.getJobVertexId() + ")" + " has a " + (predecessorState == VertexFinishedState.ALL_RUNNING ? "all running" : "partially finished") + " predecessor");
        } else if (distribution == DistributionPattern.POINTWISE && predecessorState == VertexFinishedState.ALL_RUNNING) {
            throw new FlinkRuntimeException("Illegal JobGraph modification. Cannot run a program with partially finished" + " vertices predeceased with all running ones. Task vertex " + vertex.getName() + "(" + vertex.getJobVertexId() + ")" + " has a all running predecessor");
        }
    }
}
Also used : IntermediateResult(org.apache.flink.runtime.executiongraph.IntermediateResult) HashMap(java.util.HashMap) ExecutionJobVertex(org.apache.flink.runtime.executiongraph.ExecutionJobVertex) JobEdge(org.apache.flink.runtime.jobgraph.JobEdge) JobVertexID(org.apache.flink.runtime.jobgraph.JobVertexID) DistributionPattern(org.apache.flink.runtime.jobgraph.DistributionPattern) FlinkRuntimeException(org.apache.flink.util.FlinkRuntimeException)

Aggregations

DistributionPattern (org.apache.flink.runtime.jobgraph.DistributionPattern)7 JobEdge (org.apache.flink.runtime.jobgraph.JobEdge)3 CompilerException (org.apache.flink.optimizer.CompilerException)2 JobVertex (org.apache.flink.runtime.jobgraph.JobVertex)2 BitSet (java.util.BitSet)1 HashMap (java.util.HashMap)1 DataDistribution (org.apache.flink.api.common.distributions.DataDistribution)1 Configuration (org.apache.flink.configuration.Configuration)1 UnregisteredMetricsGroup (org.apache.flink.metrics.groups.UnregisteredMetricsGroup)1 BulkIterationPlanNode (org.apache.flink.optimizer.plan.BulkIterationPlanNode)1 BulkPartialSolutionPlanNode (org.apache.flink.optimizer.plan.BulkPartialSolutionPlanNode)1 Channel (org.apache.flink.optimizer.plan.Channel)1 DualInputPlanNode (org.apache.flink.optimizer.plan.DualInputPlanNode)1 IterationPlanNode (org.apache.flink.optimizer.plan.IterationPlanNode)1 NAryUnionPlanNode (org.apache.flink.optimizer.plan.NAryUnionPlanNode)1 NamedChannel (org.apache.flink.optimizer.plan.NamedChannel)1 PlanNode (org.apache.flink.optimizer.plan.PlanNode)1 SingleInputPlanNode (org.apache.flink.optimizer.plan.SingleInputPlanNode)1 SinkPlanNode (org.apache.flink.optimizer.plan.SinkPlanNode)1 SolutionSetPlanNode (org.apache.flink.optimizer.plan.SolutionSetPlanNode)1