johnyangk commented on a change in pull request #292:
URL: https://github.com/apache/incubator-nemo/pull/292#discussion_r445346772



##########
File path: 
common/src/main/java/org/apache/nemo/common/ir/vertex/utility/runtimepass/SignalVertex.java
##########
@@ -0,0 +1,39 @@
+/*
+ * 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.nemo.common.ir.vertex.utility.runtimepass;
+
+import org.apache.nemo.common.ir.vertex.OperatorVertex;
+import 
org.apache.nemo.common.ir.vertex.executionproperty.MessageIdVertexProperty;
+import org.apache.nemo.common.ir.vertex.executionproperty.ParallelismProperty;
+import org.apache.nemo.common.ir.vertex.transform.SignalTransform;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * Signal vertex holding signal transform.
+ */
+public final class SignalVertex extends OperatorVertex {

Review comment:
       Please provide tests for this new utility vertex
   
   
https://github.com/apache/incubator-nemo/blob/master/common/src/test/java/org/apache/nemo/common/ir/IRDAGTest.java#L313

##########
File path: common/src/main/java/org/apache/nemo/common/ir/IRDAG.java
##########
@@ -576,6 +577,36 @@ public void insert(final Set<SamplingVertex> toInsert,
     modifiedDAG = builder.build(); // update the DAG.
   }
 
+  /**
+   * Insert TaskSizeSplitterVertex in dag.
+   * @param toInsert                          TaskSizeSplitterVertex to insert.
+   * @param incomingEdgesOfOriginalVertices   Edges which goes into original 
vertices wrapped by Splitter Vertex.
+   * @param outgoingEdgesOfOriginalVertices   Edges which goes out from 
original vertices wrapped by Splitter Vertex.
+   * @param edgesWithSplitterVertex           Edges which will be inserted to 
the dag with Splitter Vertex.
+   */
+  public void insert(final TaskSizeSplitterVertex toInsert,

Review comment:
       Can you add tests for this method?
   
https://github.com/apache/incubator-nemo/blob/master/common/src/test/java/org/apache/nemo/common/ir/IRDAGTest.java
   
   Specifically can this method handle testThousandRandomConfigurations? 
   
https://github.com/apache/incubator-nemo/blob/master/common/src/test/java/org/apache/nemo/common/ir/IRDAGTest.java#L313

##########
File path: 
compiler/optimizer/src/main/java/org/apache/nemo/compiler/optimizer/pass/compiletime/reshaping/SamplingTaskSizingPass.java
##########
@@ -0,0 +1,461 @@
+/*
+ * 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.nemo.compiler.optimizer.pass.compiletime.reshaping;
+
+import org.apache.nemo.common.Util;
+import org.apache.nemo.common.dag.Edge;
+import org.apache.nemo.common.ir.IRDAG;
+import org.apache.nemo.common.ir.edge.IREdge;
+import org.apache.nemo.common.ir.edge.executionproperty.*;
+import org.apache.nemo.common.ir.vertex.IRVertex;
+import 
org.apache.nemo.common.ir.vertex.executionproperty.EnableDynamicTaskSizingProperty;
+import org.apache.nemo.common.ir.vertex.executionproperty.ParallelismProperty;
+import org.apache.nemo.common.ir.vertex.utility.TaskSizeSplitterVertex;
+import org.apache.nemo.common.ir.vertex.utility.runtimepass.SignalVertex;
+import 
org.apache.nemo.compiler.optimizer.pass.compiletime.annotating.Annotates;
+import org.apache.nemo.runtime.common.plan.StagePartitioner;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * Compiler pass for dynamic task size optimization. Happens only when the 
edge property is SHUFFLE.
+ * If (size of given job) >= 1GB: enable dynamic task sizing optimization.
+ * else:                          break.
+ *
+ *
+ * @Attributes
+ * PARTITIONER_PROPERTY_FOR_SMALL_JOB:  PartitionerProperty for jobs in range 
of [1GB, 10GB) size.
+ * PARTITIONER_PROPERTY_FOR_MEDIUM_JOB: PartitionerProperty for jobs in range 
of [10GB, 100GB) size.
+ * PARTITIONER_PROPERTY_FOR_BIG_JOB:    PartitionerProperty for jobs in range 
of [100GB, - ) size(No upper limit).
+ *
+ * source stage - shuffle edge - current stage - next stage
+ * -> source stage - [curr stage - signal vertex] - next stage
+ * where [] is a splitter vertex
+ */
+@Annotates({EnableDynamicTaskSizingProperty.class, PartitionerProperty.class, 
SubPartitionSetProperty.class,
+  ParallelismProperty.class})
+public final class SamplingTaskSizingPass extends ReshapingPass {

Review comment:
       Please provide a test for this pass
   
   Ref:
   
https://github.com/apache/incubator-nemo/blob/master/examples/beam/src/test/java/org/apache/nemo/examples/beam/PerKeyMedianITCase.java#L72
   
   

##########
File path: 
common/src/main/java/org/apache/nemo/common/ir/vertex/utility/TaskSizeSplitterVertex.java
##########
@@ -0,0 +1,347 @@
+/*
+ * 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.nemo.common.ir.vertex.utility;
+
+import org.apache.commons.lang.mutable.MutableInt;
+import org.apache.nemo.common.HashRange;
+import org.apache.nemo.common.KeyRange;
+import org.apache.nemo.common.Util;
+import org.apache.nemo.common.dag.DAG;
+import org.apache.nemo.common.dag.DAGBuilder;
+import org.apache.nemo.common.ir.edge.IREdge;
+import 
org.apache.nemo.common.ir.edge.executionproperty.CommunicationPatternProperty;
+import org.apache.nemo.common.ir.edge.executionproperty.MessageIdEdgeProperty;
+import 
org.apache.nemo.common.ir.edge.executionproperty.SubPartitionSetProperty;
+import org.apache.nemo.common.ir.vertex.IRVertex;
+import org.apache.nemo.common.ir.vertex.LoopVertex;
+import org.apache.nemo.common.ir.vertex.OperatorVertex;
+import 
org.apache.nemo.common.ir.vertex.executionproperty.MessageIdVertexProperty;
+import org.apache.nemo.common.ir.vertex.executionproperty.ParallelismProperty;
+import org.apache.nemo.common.ir.vertex.transform.SignalTransform;
+import org.apache.nemo.common.ir.vertex.utility.runtimepass.SignalVertex;
+import org.apache.nemo.common.test.EmptyComponents;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.*;
+
+/**
+ * This vertex works as a partition-based sampling vertex of dynamic task 
sizing pass.
+ * It covers both sampling vertices and optimized vertices known from sampling 
by iterating same vertices, giving
+ * different properties in each iteration.
+ */
+public final class TaskSizeSplitterVertex extends LoopVertex {

Review comment:
       Personally I don't think it is a good idea to extend LoopVertex, which 
expresses iterations in applications, to implement this vertex which serves a 
quite different purpose. There is also no integrity checker for LoopVertex (all 
of the other utility vertices have corresponding checkers), so this introduces 
one more utility vertex with no integrity checker.
   
   If there is some common logic between the two, it'd be good to refactor that 
into a separate class, and make this vertex and the LoopVertex depend on that. 
And then it'd be really nice to add checkers for this vertex in the IRDAG 
integrity checker, and also add unit tests to test the checker. But I don't 
want to slow down the progress and will merge if you want to go ahead with the 
current implementation.
   
   IRDAGChecker:
   
https://github.com/apache/incubator-nemo/blob/master/common/src/main/java/org/apache/nemo/common/ir/IRDAGChecker.java
   
   




----------------------------------------------------------------
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]


Reply via email to