eaglewatcherwb commented on a change in pull request #8309: [FLINK-12229] 
[runtime] Implement LazyFromSourcesScheduling Strategy
URL: https://github.com/apache/flink/pull/8309#discussion_r289761627
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/strategy/TestingSchedulingResultPartition.java
 ##########
 @@ -0,0 +1,120 @@
+/*
+ * 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.strategy;
+
+import org.apache.flink.runtime.io.network.partition.ResultPartitionType;
+import org.apache.flink.runtime.jobgraph.IntermediateDataSetID;
+import org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+
+import static org.apache.flink.util.Preconditions.checkNotNull;
+
+/**
+ * A simple implementation of {@link SchedulingResultPartition} for testing.
+ */
+public class TestingSchedulingResultPartition implements 
SchedulingResultPartition {
+       private final IntermediateDataSetID intermediateDataSetID;
+
+       private final IntermediateResultPartitionID 
intermediateResultPartitionID;
+
+       private final ResultPartitionType partitionType;
+
+       private SchedulingExecutionVertex producer;
+
+       private Collection<SchedulingExecutionVertex> consumers;
+
+       private ResultPartitionState state;
+
+       TestingSchedulingResultPartition(IntermediateDataSetID dataSetID, 
ResultPartitionType type, ResultPartitionState state) {
+               this.intermediateDataSetID = dataSetID;
+               this.partitionType = type;
+               this.state = state;
+               this.intermediateResultPartitionID = new 
IntermediateResultPartitionID();
+               this.consumers = new ArrayList<>();
+       }
+
+       @Override
+       public IntermediateResultPartitionID getId() {
+               return intermediateResultPartitionID;
+       }
+
+       @Override
+       public IntermediateDataSetID getResultId() {
+               return intermediateDataSetID;
+       }
+
+       @Override
+       public ResultPartitionType getPartitionType() {
+               return partitionType;
+       }
+
+       @Override
+       public ResultPartitionState getState() {
+               return state;
+       }
+
+       @Override
+       public SchedulingExecutionVertex getProducer() {
+               return producer;
+       }
+
+       @Override
+       public Collection<SchedulingExecutionVertex> getConsumers() {
+               return Collections.unmodifiableCollection(consumers);
+       }
+
+       void addConsumer(SchedulingExecutionVertex consumer) {
+               this.consumers.add(consumer);
+       }
+
+       void setProducer(TestingSchedulingExecutionVertex producer) {
+               this.producer = checkNotNull(producer);
+       }
+
+       /**
+        * Builder for {@link TestingSchedulingResultPartition}.
+        */
+       public static final class Builder {
+               private IntermediateDataSetID intermediateDataSetId;
+               private ResultPartitionType resultPartitionType;
+               private ResultPartitionState resultPartitionState;
 
 Review comment:
   OK

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to