You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@nemo.apache.org by GitBox <gi...@apache.org> on 2019/08/02 10:42:55 UTC

[GitHub] [incubator-nemo] alapha23 commented on a change in pull request #227: [NEMO-398] ExecutorRepresenter interface and DefaultExecutorRepresenter

alapha23 commented on a change in pull request #227: [NEMO-398] ExecutorRepresenter interface and DefaultExecutorRepresenter
URL: https://github.com/apache/incubator-nemo/pull/227#discussion_r310078690
 
 

 ##########
 File path: runtime/master/src/main/java/org/apache/nemo/runtime/master/resource/ExecutorRepresenter.java
 ##########
 @@ -18,248 +18,90 @@
  */
 package org.apache.nemo.runtime.master.resource;
 
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.protobuf.ByteString;
-import org.apache.commons.lang3.SerializationUtils;
-import org.apache.nemo.common.ir.vertex.executionproperty.ResourceSlotProperty;
-import org.apache.nemo.runtime.common.RuntimeIdManager;
 import org.apache.nemo.runtime.common.comm.ControlMessage;
-import org.apache.nemo.runtime.common.message.MessageEnvironment;
-import org.apache.nemo.runtime.common.message.MessageSender;
 import org.apache.nemo.runtime.common.plan.Task;
-import org.apache.reef.driver.context.ActiveContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.reef.tang.annotations.DefaultImplementation;
 
-import javax.annotation.concurrent.NotThreadSafe;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
 import java.util.Set;
-import java.util.concurrent.ExecutorService;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
 
 /**
- * (WARNING) This class is not thread-safe, and thus should only be accessed through ExecutorRegistry.
- * <p>
- * Contains information/state regarding an executor.
- * Such information may include:
- * a) The executor's resource type.
- * b) The executor's capacity (ex. number of cores).
- * c) Tasks scheduled/launched for the executor.
- * d) Name of the physical node which hosts this executor.
- * e) (Please add other information as we implement more features).
+ * Interface for DefaultExecutorRepresenter and LambdaExecutorRepresenter.
  */
-@NotThreadSafe
-public final class ExecutorRepresenter {
-  private static final Logger LOG = LoggerFactory.getLogger(ExecutorRepresenter.class.getName());
-
-  private final String executorId;
-  private final ResourceSpecification resourceSpecification;
-  private final Map<String, Task> runningComplyingTasks;
-  private final Map<String, Task> runningNonComplyingTasks;
-  private final Map<Task, Integer> runningTaskToAttempt;
-  private final Set<Task> completeTasks;
-  private final Set<Task> failedTasks;
-  private final MessageSender<ControlMessage.Message> messageSender;
-  private final ActiveContext activeContext;
-  private final ExecutorService serializationExecutorService;
-  private final String nodeName;
-
-  /**
-   * Creates a reference to the specified executor.
-   *
-   * @param executorId                   the executor id
-   * @param resourceSpecification        specification for the executor
-   * @param messageSender                provides communication context for this executor
-   * @param activeContext                context on the corresponding REEF evaluator
-   * @param serializationExecutorService provides threads for message serialization
-   * @param nodeName                     physical name of the node where this executor resides
-   */
-  public ExecutorRepresenter(final String executorId,
-                             final ResourceSpecification resourceSpecification,
-                             final MessageSender<ControlMessage.Message> messageSender,
-                             final ActiveContext activeContext,
-                             final ExecutorService serializationExecutorService,
-                             final String nodeName) {
-    this.executorId = executorId;
-    this.resourceSpecification = resourceSpecification;
-    this.messageSender = messageSender;
-    this.runningComplyingTasks = new HashMap<>();
-    this.runningNonComplyingTasks = new HashMap<>();
-    this.runningTaskToAttempt = new HashMap<>();
-    this.completeTasks = new HashSet<>();
-    this.failedTasks = new HashSet<>();
-    this.activeContext = activeContext;
-    this.serializationExecutorService = serializationExecutorService;
-    this.nodeName = nodeName;
-  }
+@DefaultImplementation(DefaultExecutorRepresenter.class)
 
 Review comment:
   @Inject added

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


With regards,
Apache Git Services