sanha commented on a change in pull request #112: [NEMO-179] Delayed Task 
Cloning
URL: https://github.com/apache/incubator-nemo/pull/112#discussion_r211807678
 
 

 ##########
 File path: 
common/src/main/java/edu/snu/nemo/common/ir/vertex/executionproperty/ClonedSchedulingProperty.java
 ##########
 @@ -17,30 +17,94 @@
 
 import edu.snu.nemo.common.ir.executionproperty.VertexExecutionProperty;
 
+import java.io.Serializable;
+
 /**
  * Specifies cloned execution of a vertex.
  *
  * A major limitations of the current implementation:
  * *ALL* of the clones are always scheduled immediately
  */
-public final class ClonedSchedulingProperty extends 
VertexExecutionProperty<Integer> {
+public final class ClonedSchedulingProperty extends 
VertexExecutionProperty<ClonedSchedulingProperty.CloneConf> {
   /**
    * Constructor.
    * @param value value of the execution property.
    */
-  private ClonedSchedulingProperty(final Integer value) {
+  private ClonedSchedulingProperty(final CloneConf value) {
     super(value);
   }
 
   /**
    * Static method exposing the constructor.
-   * @param value value of the new execution property.
+   * @param conf value of the new execution property.
    * @return the newly created execution property.
    */
-  public static ClonedSchedulingProperty of(final Integer value) {
-    if (value <= 0) {
-      throw new IllegalStateException(String.valueOf(value));
+  public static ClonedSchedulingProperty of(final CloneConf conf) {
+    return new ClonedSchedulingProperty(conf);
+  }
+
+  /**
+   * Configurations for cloning.
+   */
+  public static final class CloneConf implements Serializable {
+    // Always clone, upfront.
+    private boolean upFrontCloning;
+
+    // Fraction of tasks to wait for completion, before trying to clone.
+    // If this value is 0, then we always clone.
+    private final double fractionToWaitFor;
+
+    // How many times slower is a task than the median, in order to be cloned.
+    private final double medianTimeMultiplier;
+
+    /**
+     * Always clone, upfront.
+     */
+    public CloneConf() {
+      this.upFrontCloning = true;
+      this.fractionToWaitFor = 0.0;
+      this.medianTimeMultiplier = 0.0;
+    }
+
+    /**
+     * Clone stragglers judiciously.
+     * @param fractionToWaitFor before trying to clone.
+     * @param medianTimeMultiplier to identify stragglers.
+     */
+    public CloneConf(final double fractionToWaitFor, final double 
medianTimeMultiplier) {
+      if (fractionToWaitFor >= 1.0 || fractionToWaitFor <= 0) {
+        throw new IllegalArgumentException(String.valueOf(fractionToWaitFor));
+      }
+      if (medianTimeMultiplier < 1.0) {
+        throw new 
IllegalArgumentException(String.valueOf(medianTimeMultiplier));
+      }
+      this.upFrontCloning = false;
+      this.fractionToWaitFor = fractionToWaitFor;
+      this.medianTimeMultiplier = medianTimeMultiplier;
+    }
+
+    public double getFractionToWaitFor() {
 
 Review comment:
   Please add comments for these public methods. (Checkstyle warning!)

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to