nemo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] sanha commented on a change in pull request #193: [NEMO-338] SkewSamplingPass
Date Tue, 19 Feb 2019 10:29:22 GMT
sanha commented on a change in pull request #193: [NEMO-338] SkewSamplingPass
URL: https://github.com/apache/incubator-nemo/pull/193#discussion_r257960557
 
 

 ##########
 File path: common/src/main/java/org/apache/nemo/common/Util.java
 ##########
 @@ -51,4 +59,90 @@ public static boolean checkEqualityOfIntPredicates(final IntPredicate
firstPredi
     return true;
   }
 
+  /**
+   * @param edgeToClone to copy execution properties from.
+   * @param newSrc of the new edge.
+   * @param newDst of the new edge.
+   * @return the new edge.
+   */
+  public static IREdge cloneEdge(final IREdge edgeToClone,
+                                 final IRVertex newSrc,
+                                 final IRVertex newDst) {
+    return cloneEdge(
+      edgeToClone.getPropertyValue(CommunicationPatternProperty.class).get(), edgeToClone,
newSrc, newDst);
+  }
+
+  /**
+   * Creates a new edge with several execution properties same as the given edge.
+   * The copied execution properties include those minimally required for execution, such
as encoder/decoders.
+   *
+   * @param commPattern to use.
+   * @param edgeToClone to copy execution properties from.
+   * @param newSrc of the new edge.
+   * @param newDst of the new edge.
+   * @return the new edge.
+   */
+  public static IREdge cloneEdge(final CommunicationPatternProperty.Value commPattern,
+                                 final IREdge edgeToClone,
+                                 final IRVertex newSrc,
+                                 final IRVertex newDst) {
+    final IREdge clone = new IREdge(commPattern, newSrc, newDst);
+
+    if (edgeToClone.getPropertySnapshot().containsKey(EncoderProperty.class)) {
+      clone.setProperty(edgeToClone.getPropertySnapshot().get(EncoderProperty.class));
+    } else {
+      clone.setProperty(EncoderProperty.of(edgeToClone.getPropertyValue(EncoderProperty.class).get()));
+    }
+
+    if (edgeToClone.getPropertySnapshot().containsKey(DecoderProperty.class)) {
+      clone.setProperty(edgeToClone.getPropertySnapshot().get(DecoderProperty.class));
+    } else {
+      clone.setProperty(DecoderProperty.of(edgeToClone.getPropertyValue(DecoderProperty.class).get()));
+    }
+
+    edgeToClone.getPropertyValue(AdditionalOutputTagProperty.class).ifPresent(tag -> {
+      clone.setProperty(AdditionalOutputTagProperty.of(tag));
+    });
+
+    edgeToClone.getPropertyValue(PartitionerProperty.class).ifPresent(p -> {
+      if (p.right() == PartitionerProperty.NUM_EQUAL_TO_DST_PARALLELISM) {
+        clone.setProperty(PartitionerProperty.of(p.left()));
+      } else {
+        clone.setProperty(PartitionerProperty.of(p.left(), p.right()));
+      }
+    });
+
+    edgeToClone.getPropertyValue(KeyExtractorProperty.class).ifPresent(ke -> {
+      clone.setProperty(KeyExtractorProperty.of(ke));
+    });
+
+    return clone;
+  }
+
+  /**
+   * @param src vertex.
+   * @param dst vertex.
+   * @return the control edge.
+   */
+  public static IREdge createControlEdge(final IRVertex src, final IRVertex dst) {
 
 Review comment:
   Please add some method level comment for this method.

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


With regards,
Apache Git Services

Mime
View raw message