reef-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (REEF-2025) A new module containing the new Java bridge
Date Fri, 01 Jun 2018 00:34:01 GMT

    [ https://issues.apache.org/jira/browse/REEF-2025?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16497389#comment-16497389
] 

ASF GitHub Bot commented on REEF-2025:
--------------------------------------

motus commented on a change in pull request #1466: [REEF-2025] A new module containing the
new Java bridge
URL: https://github.com/apache/reef/pull/1466#discussion_r192269877
 
 

 ##########
 File path: lang/java/reef-bridge-proto-java/src/main/java/org/apache/reef/bridge/driver/client/events/AllocatedEvaluatorBridge.java
 ##########
 @@ -0,0 +1,166 @@
+/*
+ * 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.reef.bridge.driver.client.events;
+
+import org.apache.reef.annotations.audience.Private;
+import org.apache.reef.bridge.driver.client.IDriverServiceClient;
+import org.apache.reef.bridge.driver.client.JVMClientProcess;
+import org.apache.reef.driver.evaluator.AllocatedEvaluator;
+import org.apache.reef.driver.evaluator.EvaluatorDescriptor;
+import org.apache.reef.driver.evaluator.EvaluatorProcess;
+import org.apache.reef.tang.Configuration;
+import org.apache.reef.util.Optional;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Allocated Evaluator Stub.
+ */
+@Private
+public final class AllocatedEvaluatorBridge implements AllocatedEvaluator {
+
+  private final String evaluatorId;
+
+  private final EvaluatorDescriptor evaluatorDescriptor;
+
+  private final IDriverServiceClient driverServiceClient;
+
+  private final List<File> addFileList = new ArrayList<>();
+
+  private final List<File> addLibraryList = new ArrayList<>();
+
+  private JVMClientProcess evaluatorProcess = null;
+
+  public AllocatedEvaluatorBridge(
+      final String evaluatorId,
+      final EvaluatorDescriptor evaluatorDescriptor,
+      final IDriverServiceClient driverServiceClient) {
+    this.evaluatorId = evaluatorId;
+    this.evaluatorDescriptor = evaluatorDescriptor;
+    this.driverServiceClient = driverServiceClient;
+  }
+
+  @Override
+  public String getId() {
+    return this.evaluatorId;
+  }
+
+  @Override
+  public void addFile(final File file) {
+    this.addFileList.add(file);
+  }
+
+  @Override
+  public void addLibrary(final File file) {
+    this.addLibraryList.add(file);
+  }
+
+  @Override
+  public EvaluatorDescriptor getEvaluatorDescriptor() {
+    return this.evaluatorDescriptor;
+  }
+
+  @Override
+  public void setProcess(final EvaluatorProcess process) {
+    if (process instanceof JVMClientProcess) {
+      this.evaluatorProcess = (JVMClientProcess) process;
+    } else {
+      throw new IllegalArgumentException(JVMClientProcess.class.getCanonicalName() + " required.");
+    }
+  }
+
+  @Override
+  public void close() {
+    this.driverServiceClient.onEvaluatorClose(getId());
+  }
+
+  @Override
+  public void submitTask(final Configuration taskConfiguration) {
+    this.driverServiceClient.onEvaluatorSubmit(
+        getId(),
+        Optional.<Configuration>empty(),
+        Optional.of(taskConfiguration),
+        this.evaluatorProcess== null ?
+            Optional.<JVMClientProcess>empty() :
+            Optional.of(this.evaluatorProcess),
+        this.addFileList.size() == 0 ?
+            Optional.<List<File>>empty() :
+            Optional.of(this.addFileList),
+        this.addLibraryList.size() == 0 ?
+            Optional.<List<File>>empty() :
+            Optional.of(this.addLibraryList));
+  }
+
+  @Override
+  public void submitContext(final Configuration contextConfiguration) {
+
+    this.driverServiceClient.onEvaluatorSubmit(
+        getId(),
+        Optional.of(contextConfiguration),
+        Optional.<Configuration>empty(),
+        this.evaluatorProcess== null ?
+            Optional.<JVMClientProcess>empty() :
+            Optional.of(this.evaluatorProcess),
+        this.addFileList.size() == 0 ?
+            Optional.<List<File>>empty() :
+            Optional.of(this.addFileList),
+        this.addLibraryList.size() == 0 ?
+            Optional.<List<File>>empty() :
+            Optional.of(this.addLibraryList));
+  }
+
+  @Override
+  public void submitContextAndService(
+      final Configuration contextConfiguration,
+      final Configuration serviceConfiguration) {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
+  public void submitContextAndTask(
+      final Configuration contextConfiguration,
+      final Configuration taskConfiguration) {
+
+    this.driverServiceClient.onEvaluatorSubmit(
+        getId(),
+        Optional.of(contextConfiguration),
+        Optional.of(taskConfiguration),
+        this.evaluatorProcess== null ?
+            Optional.<JVMClientProcess>empty() :
+            Optional.of(this.evaluatorProcess),
+        this.addFileList.size() == 0 ?
+            Optional.<List<File>>empty() :
+            Optional.of(this.addFileList),
+        this.addLibraryList.size() == 0 ?
+            Optional.<List<File>>empty() :
+            Optional.of(this.addLibraryList));
 
 Review comment:
   same as above

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


> A new module containing the new Java bridge
> -------------------------------------------
>
>                 Key: REEF-2025
>                 URL: https://issues.apache.org/jira/browse/REEF-2025
>             Project: REEF
>          Issue Type: Sub-task
>          Components: REEF Bridge
>    Affects Versions: 0.17
>            Reporter: Tyson Condie
>            Assignee: Tyson Condie
>            Priority: Major
>             Fix For: 0.17
>
>
> This Jira introduces the module containing the new bridge. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message