All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.flink.runtime.scheduler.adapter.DefaultExecutionVertex Maven / Gradle / Ivy

The newest version!
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.flink.runtime.scheduler.adapter;

import org.apache.flink.runtime.execution.ExecutionState;
import org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID;
import org.apache.flink.runtime.scheduler.strategy.ConsumedPartitionGroup;
import org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID;
import org.apache.flink.runtime.scheduler.strategy.SchedulingExecutionVertex;
import org.apache.flink.util.IterableUtils;

import java.util.List;
import java.util.function.Function;
import java.util.function.Supplier;

import static org.apache.flink.util.Preconditions.checkNotNull;

/** Default implementation of {@link SchedulingExecutionVertex}. */
class DefaultExecutionVertex implements SchedulingExecutionVertex {

    private final ExecutionVertexID executionVertexId;

    private final List producedResults;

    private final Supplier stateSupplier;

    private final List consumedPartitionGroups;

    private final Function
            resultPartitionRetriever;

    DefaultExecutionVertex(
            ExecutionVertexID executionVertexId,
            List producedPartitions,
            Supplier stateSupplier,
            List consumedPartitionGroups,
            Function
                    resultPartitionRetriever) {
        this.executionVertexId = checkNotNull(executionVertexId);
        this.stateSupplier = checkNotNull(stateSupplier);
        this.producedResults = checkNotNull(producedPartitions);
        this.consumedPartitionGroups = checkNotNull(consumedPartitionGroups);
        this.resultPartitionRetriever = checkNotNull(resultPartitionRetriever);
    }

    @Override
    public ExecutionVertexID getId() {
        return executionVertexId;
    }

    @Override
    public ExecutionState getState() {
        return stateSupplier.get();
    }

    @Override
    public Iterable getConsumedResults() {
        return IterableUtils.flatMap(consumedPartitionGroups, resultPartitionRetriever);
    }

    @Override
    public List getConsumedPartitionGroups() {
        return consumedPartitionGroups;
    }

    @Override
    public Iterable getProducedResults() {
        return producedResults;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy