Repository: incubator-reef Updated Branches: refs/heads/master 41cbbcbbe -> 20050eb65
[REEF-326] Create classes representing Evaluator Processes Create class representations of the process instantiation of an Evaluator. As we currently support CLR and JVM, a class is created for each. Classes are introduced, deprecating the original enum approach. JIRA: [REEF-326](https://github.com/apache/incubator-reef/pull/183) Pull Request: This closes #183 Project: http://git-wip-us.apache.org/repos/asf/incubator-reef/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-reef/commit/20050eb6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-reef/tree/20050eb6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-reef/diff/20050eb6 Branch: refs/heads/master Commit: 20050eb657f147e2ae3d8763a5dbe74e20b04542 Parents: 41cbbcb Author: Brian Cho <[email protected]> Authored: Sat May 16 11:35:37 2015 -0700 Committer: Markus Weimer <[email protected]> Committed: Sat May 16 11:37:59 2015 -0700 ---------------------------------------------------------------------- .../reef/javabridge/generic/JobDriver.java | 16 +++- .../driver/evaluator/AllocatedEvaluator.java | 10 +++ .../reef/driver/evaluator/CLRProcess.java | 83 ++++++++++++++++++ .../driver/evaluator/CLRProcessFactory.java | 40 +++++++++ .../driver/evaluator/EvaluatorDescriptor.java | 10 +-- .../reef/driver/evaluator/EvaluatorProcess.java | 85 ++++++++++++++++++ .../evaluator/EvaluatorProcessFactory.java | 33 +++++++ .../reef/driver/evaluator/JVMProcess.java | 92 ++++++++++++++++++++ .../driver/evaluator/JVMProcessFactory.java | 46 ++++++++++ .../common/driver/api/ResourceLaunchEvent.java | 6 +- .../driver/api/ResourceLaunchEventImpl.java | 18 ++-- .../evaluator/AllocatedEvaluatorImpl.java | 41 ++++++--- .../evaluator/EvaluatorDescriptorImpl.java | 24 ++--- .../driver/evaluator/EvaluatorManager.java | 25 ++++-- .../evaluator/EvaluatorManagerFactory.java | 11 +-- .../common/files/RuntimePathProvider.java | 29 ++++++ .../common/files/UnixJVMPathProvider.java | 35 ++++++++ .../reef/examples/helloCLR/HelloDriver.java | 10 ++- .../hdinsight/HDInsightJVMPathProvider.java | 36 ++++++++ .../client/HDInsightDriverConfiguration.java | 3 + .../HDInsightRuntimeConfigurationStatic.java | 3 + .../runtime/local/driver/ResourceManager.java | 18 +--- .../driver/MesosResourceLaunchHandler.java | 19 +--- .../yarn/driver/YARNResourceLaunchHandler.java | 25 +----- .../webserver/AvroEvaluatorInfoSerializer.java | 2 +- .../webserver/HttpServerReefEventHandler.java | 2 +- .../webserver/TestAvroSerializerForHttp.java | 17 ++-- .../webserver/TestReefEventStateManager.java | 15 +++- 28 files changed, 624 insertions(+), 130 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/generic/JobDriver.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/generic/JobDriver.java b/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/generic/JobDriver.java index 69d8071..1e02349 100644 --- a/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/generic/JobDriver.java +++ b/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/generic/JobDriver.java @@ -29,6 +29,7 @@ import org.apache.reef.io.network.naming.NameServer; import org.apache.reef.javabridge.*; import org.apache.reef.runtime.common.DriverRestartCompleted; import org.apache.reef.runtime.common.driver.DriverStatusManager; +import org.apache.reef.driver.evaluator.EvaluatorProcess; import org.apache.reef.tang.annotations.Unit; import org.apache.reef.util.Optional; import org.apache.reef.util.logging.CLRBufferedLogHandler; @@ -98,6 +99,11 @@ public final class JobDriver { private final LibLoader libLoader; /** + * Factory to setup new CLR process configurations + */ + private final CLRProcessFactory clrProcessFactory; + + /** * Shell execution results from each Evaluator. */ private final List<String> results = new ArrayList<>(); @@ -150,7 +156,8 @@ public final class JobDriver { final LoggingScopeFactory loggingScopeFactory, final LibLoader libLoader, final LocalAddressProvider localAddressProvider, - final ActiveContextBridgeFactory activeContextBridgeFactory) { + final ActiveContextBridgeFactory activeContextBridgeFactory, + final CLRProcessFactory clrProcessFactory) { this.clock = clock; this.httpServer = httpServer; this.jobMessageObserver = jobMessageObserver; @@ -161,6 +168,7 @@ public final class JobDriver { this.nameServerInfo = localAddressProvider.getLocalAddress() + ":" + this.nameServer.getPort(); this.loggingScopeFactory = loggingScopeFactory; this.libLoader = libLoader; + this.clrProcessFactory = clrProcessFactory; } private void setupBridge(final StartTime startTime) { @@ -239,9 +247,9 @@ public final class JobDriver { return null; } - private void submitEvaluator(final AllocatedEvaluator eval, EvaluatorType type) { + private void submitEvaluator(final AllocatedEvaluator eval, final EvaluatorProcess process) { synchronized (JobDriver.this) { - eval.setType(type); + eval.setProcess(process); LOG.log(Level.INFO, "Allocated Evaluator: {0}, total running running {1}", new Object[]{eval.getId(), JobDriver.this.contexts.size()}); if (JobDriver.this.allocatedEvaluatorHandler == 0) { @@ -279,7 +287,7 @@ public final class JobDriver { try (final LoggingScope ls = loggingScopeFactory.evaluatorAllocated(allocatedEvaluator.getId())) { synchronized (JobDriver.this) { LOG.log(Level.INFO, "AllocatedEvaluatorHandler.OnNext"); - JobDriver.this.submitEvaluator(allocatedEvaluator, EvaluatorType.CLR); + JobDriver.this.submitEvaluator(allocatedEvaluator, clrProcessFactory.newEvaluatorProcess()); } } } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/AllocatedEvaluator.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/AllocatedEvaluator.java b/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/AllocatedEvaluator.java index 198bf00..7ad3250 100644 --- a/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/AllocatedEvaluator.java +++ b/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/AllocatedEvaluator.java @@ -64,10 +64,20 @@ public interface AllocatedEvaluator * Set the type of Evaluator to be instantiated. Defaults to EvaluatorType.JVM. * * @param type + * @deprecated Replace with #setProcess */ + @Deprecated void setType(final EvaluatorType type); /** + * Specify the process to be instantiated for the Evaluator. + * Defaults to an EvaluatorProcess instantiated by the binded ProcessFactory. + * + * @param process + */ + void setProcess(final EvaluatorProcess process); + + /** * Releases the allocated evaluator back to the resource manager. */ @Override http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/CLRProcess.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/CLRProcess.java b/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/CLRProcess.java new file mode 100644 index 0000000..09f4a00 --- /dev/null +++ b/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/CLRProcess.java @@ -0,0 +1,83 @@ +/* + * 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.driver.evaluator; + +import org.apache.reef.runtime.common.launch.CLRLaunchCommandBuilder; + +import java.util.List; + +/** + * Defines the setup of a CLR process + */ +public final class CLRProcess implements EvaluatorProcess { + private final CLRLaunchCommandBuilder commandBuilder = new CLRLaunchCommandBuilder(); + + /** + * Instantiated via CLRProcessFactory + */ + CLRProcess() { + } + + @Override + public List<String> getCommandLine() { + return commandBuilder + .build(); + } + + @Override + public EvaluatorType getType() { + return EvaluatorType.CLR; + } + + @Override + public EvaluatorProcess setErrorHandlerRID(final String errorHandlerRID) { + commandBuilder.setErrorHandlerRID(errorHandlerRID); + return this; + } + + @Override + public EvaluatorProcess setLaunchID(final String launchID) { + commandBuilder.setLaunchID(launchID); + return this; + } + + @Override + public EvaluatorProcess setMemory(final int megaBytes) { + commandBuilder.setMemory(megaBytes); + return this; + } + + @Override + public EvaluatorProcess setConfigurationFileName(final String configurationFileName) { + commandBuilder.setConfigurationFileName(configurationFileName); + return this; + } + + @Override + public EvaluatorProcess setStandardOut(final String standardOut) { + commandBuilder.setStandardOut(standardOut); + return this; + } + + @Override + public EvaluatorProcess setStandardErr(final String standardErr) { + commandBuilder.setStandardErr(standardErr); + return this; + } +} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/CLRProcessFactory.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/CLRProcessFactory.java b/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/CLRProcessFactory.java new file mode 100644 index 0000000..49d4d80 --- /dev/null +++ b/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/CLRProcessFactory.java @@ -0,0 +1,40 @@ +/* + * 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.driver.evaluator; + +import org.apache.reef.annotations.audience.DriverSide; +import org.apache.reef.annotations.audience.Private; + +import javax.inject.Inject; + +/** + * Factory to setup new CLR processes + */ +@Private +@DriverSide +public final class CLRProcessFactory implements EvaluatorProcessFactory { + @Inject + private CLRProcessFactory() { + } + + @Override + public EvaluatorProcess newEvaluatorProcess() { + return new CLRProcess(); + } +} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/EvaluatorDescriptor.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/EvaluatorDescriptor.java b/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/EvaluatorDescriptor.java index 55a0ddd..c45a059 100644 --- a/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/EvaluatorDescriptor.java +++ b/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/EvaluatorDescriptor.java @@ -28,20 +28,20 @@ public interface EvaluatorDescriptor { /** * @return the NodeDescriptor of the node where this Evaluator is running. */ - public NodeDescriptor getNodeDescriptor(); + NodeDescriptor getNodeDescriptor(); /** - * @return the type of Evaluator. + * @return the process to be run on the Evaluator. */ - public EvaluatorType getType(); + EvaluatorProcess getProcess(); /** * @return the amount of memory allocated to this Evaluator. */ - public int getMemory(); + int getMemory(); /** * @return the number of virtual core allocated to this Evaluator. */ - public int getNumberOfCores(); + int getNumberOfCores(); } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/EvaluatorProcess.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/EvaluatorProcess.java b/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/EvaluatorProcess.java new file mode 100644 index 0000000..b20b432 --- /dev/null +++ b/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/EvaluatorProcess.java @@ -0,0 +1,85 @@ +/* + * 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.driver.evaluator; + +import java.util.List; + +/** + * Defines the setup of an evaluator's process + */ +public interface EvaluatorProcess { + /** + * @return the launch command line + */ + List<String> getCommandLine(); + + /** + * @return the type of the evaluator + */ + EvaluatorType getType(); + + /** + * Set the error handler remote identifier + * + * @param errorHandlerRID + * @return this + */ + EvaluatorProcess setErrorHandlerRID(final String errorHandlerRID); + + /** + * Set the launch identifier + * + * @param launchID + * @return this + */ + EvaluatorProcess setLaunchID(final String launchID); + + /** + * Set memory size of process in megabytes + * + * @param megaBytes + * @return this + */ + EvaluatorProcess setMemory(final int megaBytes); + + /** + * Set the name of the configuration file for the Launcher. This file is assumed to exist in the working directory of + * the process launched with this command line. + * + * @param configurationFileName + * @return this + */ + EvaluatorProcess setConfigurationFileName(final String configurationFileName); + + /** + * Names a file to which stdout will be redirected. + * + * @param standardOut + * @return this + */ + EvaluatorProcess setStandardOut(final String standardOut); + + /** + * Names a file to which stderr will be redirected. + * + * @param standardErr + * @return this + */ + EvaluatorProcess setStandardErr(final String standardErr); +} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/EvaluatorProcessFactory.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/EvaluatorProcessFactory.java b/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/EvaluatorProcessFactory.java new file mode 100644 index 0000000..3610dc6 --- /dev/null +++ b/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/EvaluatorProcessFactory.java @@ -0,0 +1,33 @@ +/* + * 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.driver.evaluator; + +import org.apache.reef.annotations.audience.DriverSide; +import org.apache.reef.annotations.audience.Public; +import org.apache.reef.tang.annotations.DefaultImplementation; + +/** + * Factory to create new evaluator process setups + */ +@Public +@DriverSide +@DefaultImplementation(JVMProcessFactory.class) +public interface EvaluatorProcessFactory { + EvaluatorProcess newEvaluatorProcess(); +} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/JVMProcess.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/JVMProcess.java b/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/JVMProcess.java new file mode 100644 index 0000000..f068245 --- /dev/null +++ b/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/JVMProcess.java @@ -0,0 +1,92 @@ +/* + * 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.driver.evaluator; + +import org.apache.reef.runtime.common.files.ClasspathProvider; +import org.apache.reef.runtime.common.files.RuntimePathProvider; +import org.apache.reef.runtime.common.launch.JavaLaunchCommandBuilder; + +import java.util.List; + +/** + * Defines the setup of a JVM process + */ +public final class JVMProcess implements EvaluatorProcess { + private final JavaLaunchCommandBuilder commandBuilder = new JavaLaunchCommandBuilder(); + private final RuntimePathProvider runtimePathProvider; + private final ClasspathProvider classpathProvider; + + /** + * Instantiated via JVMProcessFactory + */ + JVMProcess(final RuntimePathProvider runtimePathProvider, + final ClasspathProvider classpathProvider) { + this.runtimePathProvider = runtimePathProvider; + this.classpathProvider = classpathProvider; + } + + @Override + public List<String> getCommandLine() { + return commandBuilder + .setJavaPath(runtimePathProvider.getPath()) + .setClassPath(classpathProvider.getEvaluatorClasspath()) + .build(); + } + + @Override + public EvaluatorType getType() { + return EvaluatorType.JVM; + } + + @Override + public EvaluatorProcess setErrorHandlerRID(final String errorHandlerRID) { + commandBuilder.setErrorHandlerRID(errorHandlerRID); + return this; + } + + @Override + public EvaluatorProcess setLaunchID(final String launchID) { + commandBuilder.setLaunchID(launchID); + return this; + } + + @Override + public EvaluatorProcess setMemory(final int megaBytes) { + commandBuilder.setMemory(megaBytes); + return this; + } + + @Override + public EvaluatorProcess setConfigurationFileName(final String configurationFileName) { + commandBuilder.setConfigurationFileName(configurationFileName); + return this; + } + + @Override + public EvaluatorProcess setStandardOut(final String standardOut) { + commandBuilder.setStandardOut(standardOut); + return this; + } + + @Override + public EvaluatorProcess setStandardErr(final String standardErr) { + commandBuilder.setStandardErr(standardErr); + return this; + } +} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/JVMProcessFactory.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/JVMProcessFactory.java b/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/JVMProcessFactory.java new file mode 100644 index 0000000..489751e --- /dev/null +++ b/lang/java/reef-common/src/main/java/org/apache/reef/driver/evaluator/JVMProcessFactory.java @@ -0,0 +1,46 @@ +/* + * 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.driver.evaluator; + +import org.apache.reef.annotations.audience.DriverSide; +import org.apache.reef.runtime.common.files.ClasspathProvider; +import org.apache.reef.runtime.common.files.RuntimePathProvider; + +import javax.inject.Inject; + +/** + * Factory to setup new JVM processes + */ +@DriverSide +public final class JVMProcessFactory implements EvaluatorProcessFactory { + private final RuntimePathProvider pathProvider; + private final ClasspathProvider classpathProvider; + + @Inject + private JVMProcessFactory(final RuntimePathProvider pathProvider, + final ClasspathProvider classpathProvider) { + this.pathProvider = pathProvider; + this.classpathProvider = classpathProvider; + } + + @Override + public EvaluatorProcess newEvaluatorProcess() { + return new JVMProcess(pathProvider, classpathProvider); + } +} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/api/ResourceLaunchEvent.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/api/ResourceLaunchEvent.java b/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/api/ResourceLaunchEvent.java index 8a04810..a078a35 100644 --- a/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/api/ResourceLaunchEvent.java +++ b/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/api/ResourceLaunchEvent.java @@ -20,8 +20,8 @@ package org.apache.reef.runtime.common.driver.api; import org.apache.reef.annotations.audience.DriverSide; import org.apache.reef.annotations.audience.RuntimeAuthor; +import org.apache.reef.driver.evaluator.EvaluatorProcess; import org.apache.reef.runtime.common.files.FileResource; -import org.apache.reef.runtime.common.launch.ProcessType; import org.apache.reef.tang.Configuration; import org.apache.reef.tang.annotations.DefaultImplementation; @@ -52,9 +52,9 @@ public interface ResourceLaunchEvent { Configuration getEvaluatorConf(); /** - * @return Type of process to launch + * @return Evaluator process to launch */ - ProcessType getType(); + EvaluatorProcess getProcess(); /** * @return List of libraries local to this Evaluator http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/api/ResourceLaunchEventImpl.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/api/ResourceLaunchEventImpl.java b/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/api/ResourceLaunchEventImpl.java index 976725a..faf1d6d 100644 --- a/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/api/ResourceLaunchEventImpl.java +++ b/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/api/ResourceLaunchEventImpl.java @@ -18,10 +18,10 @@ */ package org.apache.reef.runtime.common.driver.api; +import org.apache.reef.driver.evaluator.EvaluatorProcess; import org.apache.reef.runtime.common.files.FileResource; import org.apache.reef.runtime.common.files.FileResourceImpl; import org.apache.reef.runtime.common.files.FileType; -import org.apache.reef.runtime.common.launch.ProcessType; import org.apache.reef.tang.Configuration; import org.apache.reef.util.BuilderUtils; @@ -38,14 +38,14 @@ public final class ResourceLaunchEventImpl implements ResourceLaunchEvent { private final String identifier; private final String remoteId; private final Configuration evaluatorConf; - private final ProcessType type; + private final EvaluatorProcess process; private final Set<FileResource> fileSet; private ResourceLaunchEventImpl(final Builder builder) { this.identifier = BuilderUtils.notNull(builder.identifier); this.remoteId = BuilderUtils.notNull(builder.remoteId); this.evaluatorConf = BuilderUtils.notNull(builder.evaluatorConf); - this.type = BuilderUtils.notNull(builder.type); + this.process = BuilderUtils.notNull(builder.process); this.fileSet = BuilderUtils.notNull(builder.fileSet); } @@ -65,8 +65,8 @@ public final class ResourceLaunchEventImpl implements ResourceLaunchEvent { } @Override - public ProcessType getType() { - return type; + public EvaluatorProcess getProcess() { + return process; } @Override @@ -85,7 +85,7 @@ public final class ResourceLaunchEventImpl implements ResourceLaunchEvent { private String identifier; private String remoteId; private Configuration evaluatorConf; - private ProcessType type; + private EvaluatorProcess process; private Set<FileResource> fileSet = new HashSet<>(); /** @@ -113,10 +113,10 @@ public final class ResourceLaunchEventImpl implements ResourceLaunchEvent { } /** - * @see ResourceLaunchEvent#getType() + * @see ResourceLaunchEvent#getProcess() */ - public Builder setType(final ProcessType type) { - this.type = type; + public Builder setProcess(final EvaluatorProcess process) { + this.process = process; return this; } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/AllocatedEvaluatorImpl.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/AllocatedEvaluatorImpl.java b/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/AllocatedEvaluatorImpl.java index 2bec99b..950f05d 100644 --- a/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/AllocatedEvaluatorImpl.java +++ b/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/AllocatedEvaluatorImpl.java @@ -22,11 +22,13 @@ import org.apache.reef.annotations.audience.DriverSide; import org.apache.reef.annotations.audience.Private; import org.apache.reef.driver.context.ContextConfiguration; import org.apache.reef.driver.evaluator.AllocatedEvaluator; +import org.apache.reef.driver.evaluator.CLRProcessFactory; import org.apache.reef.driver.evaluator.EvaluatorDescriptor; import org.apache.reef.driver.evaluator.EvaluatorType; +import org.apache.reef.driver.evaluator.EvaluatorProcess; +import org.apache.reef.driver.evaluator.JVMProcessFactory; import org.apache.reef.runtime.common.driver.api.ResourceLaunchEventImpl; import org.apache.reef.runtime.common.evaluator.EvaluatorConfiguration; -import org.apache.reef.runtime.common.launch.ProcessType; import org.apache.reef.tang.Configuration; import org.apache.reef.tang.ConfigurationBuilder; import org.apache.reef.tang.ConfigurationProvider; @@ -59,6 +61,9 @@ final class AllocatedEvaluatorImpl implements AllocatedEvaluator { private final String jobIdentifier; private final LoggingScopeFactory loggingScopeFactory; private final Set<ConfigurationProvider> evaluatorConfigurationProviders; + // TODO: The factories should be removed when deprecated setType is removed, as the process should not be created here + private final JVMProcessFactory jvmProcessFactory; + private final CLRProcessFactory clrProcessFactory; /** * The set of files to be places on the Evaluator. @@ -74,13 +79,17 @@ final class AllocatedEvaluatorImpl implements AllocatedEvaluator { final ConfigurationSerializer configurationSerializer, final String jobIdentifier, final LoggingScopeFactory loggingScopeFactory, - final Set<ConfigurationProvider> evaluatorConfigurationProviders) { + final Set<ConfigurationProvider> evaluatorConfigurationProviders, + final JVMProcessFactory jvmProcessFactory, + final CLRProcessFactory clrProcessFactory) { this.evaluatorManager = evaluatorManager; this.remoteID = remoteID; this.configurationSerializer = configurationSerializer; this.jobIdentifier = jobIdentifier; this.loggingScopeFactory = loggingScopeFactory; this.evaluatorConfigurationProviders = evaluatorConfigurationProviders; + this.jvmProcessFactory = jvmProcessFactory; + this.clrProcessFactory = clrProcessFactory; } @Override @@ -133,8 +142,21 @@ final class AllocatedEvaluatorImpl implements AllocatedEvaluator { } @Override + @Deprecated public void setType(final EvaluatorType type) { - this.evaluatorManager.setType(type); + switch (type) { + case CLR: + setProcess(clrProcessFactory.newEvaluatorProcess()); + break; + default: + setProcess(jvmProcessFactory.newEvaluatorProcess()); + break; + } + } + + @Override + public void setProcess(final EvaluatorProcess process) { + this.evaluatorManager.setProcess(process); } @Override @@ -162,20 +184,11 @@ final class AllocatedEvaluatorImpl implements AllocatedEvaluator { .addFiles(this.files) .addLibraries(this.libraries); - { // Set the type - switch (this.evaluatorManager.getEvaluatorDescriptor().getType()) { - case CLR: - rbuilder.setType(ProcessType.CLR); - break; - default: - rbuilder.setType(ProcessType.JVM); - } - } + rbuilder.setProcess(this.evaluatorManager.getEvaluatorDescriptor().getProcess()); this.evaluatorManager.onResourceLaunch(rbuilder.build()); } } - private Configuration makeEvaluatorConfiguration(final Configuration contextConfiguration, final Optional<Configuration> serviceConfiguration, final Optional<Configuration> taskConfiguration) { @@ -211,7 +224,7 @@ final class AllocatedEvaluatorImpl implements AllocatedEvaluator { * serviceConfiguration, if any. */ private Optional<Configuration> makeRootServiceConfiguration(final Optional<Configuration> serviceConfiguration) { - final EvaluatorType evaluatorType = this.evaluatorManager.getEvaluatorDescriptor().getType(); + final EvaluatorType evaluatorType = this.evaluatorManager.getEvaluatorDescriptor().getProcess().getType(); if (EvaluatorType.CLR == evaluatorType) { LOG.log(Level.FINE, "Not using the ConfigurationProviders as we are configuring a {0} Evaluator.", evaluatorType); return serviceConfiguration; http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorDescriptorImpl.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorDescriptorImpl.java b/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorDescriptorImpl.java index 1a0bbcc..6133fc4 100644 --- a/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorDescriptorImpl.java +++ b/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorDescriptorImpl.java @@ -22,7 +22,7 @@ import org.apache.reef.annotations.audience.DriverSide; import org.apache.reef.annotations.audience.Private; import org.apache.reef.driver.catalog.NodeDescriptor; import org.apache.reef.driver.evaluator.EvaluatorDescriptor; -import org.apache.reef.driver.evaluator.EvaluatorType; +import org.apache.reef.driver.evaluator.EvaluatorProcess; /** * A simple all-data implementation of EvaluatorDescriptor @@ -34,16 +34,16 @@ final class EvaluatorDescriptorImpl implements EvaluatorDescriptor { private final NodeDescriptor nodeDescriptor; private final int megaBytes; private final int numberOfCores; - private EvaluatorType type; + private EvaluatorProcess process; public EvaluatorDescriptorImpl(final NodeDescriptor nodeDescriptor, - final EvaluatorType type, final int megaBytes, - final int numberOfCores) { + final int numberOfCores, + final EvaluatorProcess process) { this.nodeDescriptor = nodeDescriptor; - this.type = type; this.megaBytes = megaBytes; this.numberOfCores = numberOfCores; + this.process = process; } @Override @@ -52,15 +52,15 @@ final class EvaluatorDescriptorImpl implements EvaluatorDescriptor { } @Override - public synchronized EvaluatorType getType() { - return this.type; + public synchronized EvaluatorProcess getProcess() { + if (null == this.process) { + throw new IllegalArgumentException("EvaluatorProcess must be set"); + } + return this.process; } - public synchronized void setType(final EvaluatorType type) { - if (this.getType() != EvaluatorType.UNDECIDED) { - throw new RuntimeException("Unable to change state of an Evaluator of Type: " + this.getType()); - } - this.type = type; + public synchronized void setProcess(final EvaluatorProcess process) { + this.process = process; } @Override http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java b/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java index 0c2edb0..da533af 100644 --- a/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java +++ b/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java @@ -20,12 +20,13 @@ package org.apache.reef.runtime.common.driver.evaluator; import org.apache.reef.annotations.audience.DriverSide; import org.apache.reef.annotations.audience.Private; +import org.apache.reef.driver.evaluator.CLRProcessFactory; import org.apache.reef.tang.ConfigurationProvider; import org.apache.reef.driver.context.ActiveContext; import org.apache.reef.driver.context.FailedContext; import org.apache.reef.driver.evaluator.AllocatedEvaluator; import org.apache.reef.driver.evaluator.EvaluatorDescriptor; -import org.apache.reef.driver.evaluator.EvaluatorType; +import org.apache.reef.driver.evaluator.JVMProcessFactory; import org.apache.reef.driver.parameters.EvaluatorConfigurationProviders; import org.apache.reef.driver.task.FailedTask; import org.apache.reef.exception.EvaluatorException; @@ -35,6 +36,7 @@ import org.apache.reef.proto.EvaluatorRuntimeProtocol; import org.apache.reef.proto.ReefServiceProtos; import org.apache.reef.runtime.common.DriverRestartCompleted; import org.apache.reef.runtime.common.driver.DriverStatusManager; +import org.apache.reef.driver.evaluator.EvaluatorProcess; import org.apache.reef.runtime.common.driver.api.ResourceLaunchEvent; import org.apache.reef.runtime.common.driver.api.ResourceReleaseEventImpl; import org.apache.reef.runtime.common.driver.api.ResourceLaunchHandler; @@ -96,8 +98,6 @@ public final class EvaluatorManager implements Identifiable, AutoCloseable { private final ExceptionCodec exceptionCodec; private final DriverStatusManager driverStatusManager; private final EventHandlerIdlenessSource idlenessSource; - private final LoggingScopeFactory loggingScopeFactory; - // Mutable fields private Optional<TaskRepresenter> task = Optional.empty(); @@ -121,7 +121,10 @@ public final class EvaluatorManager implements Identifiable, AutoCloseable { final ExceptionCodec exceptionCodec, final EventHandlerIdlenessSource idlenessSource, final LoggingScopeFactory loggingScopeFactory, - final @Parameter(EvaluatorConfigurationProviders.class) Set<ConfigurationProvider> evaluatorConfigurationProviders) { + final @Parameter(EvaluatorConfigurationProviders.class) Set<ConfigurationProvider> evaluatorConfigurationProviders, + // TODO: Eventually remove the factories when they are removed from AllocatedEvaluatorImpl + final JVMProcessFactory jvmProcessFactory, + final CLRProcessFactory clrProcessFactory) { this.contextRepresenters = contextRepresenters; this.idlenessSource = idlenessSource; LOG.log(Level.FINEST, "Instantiating 'EvaluatorManager' for evaluator: {0}", evaluatorId); @@ -137,10 +140,16 @@ public final class EvaluatorManager implements Identifiable, AutoCloseable { this.stateManager = stateManager; this.driverStatusManager = driverStatusManager; this.exceptionCodec = exceptionCodec; - this.loggingScopeFactory = loggingScopeFactory; final AllocatedEvaluator allocatedEvaluator = - new AllocatedEvaluatorImpl(this, remoteManager.getMyIdentifier(), configurationSerializer, getJobIdentifier(), loggingScopeFactory, evaluatorConfigurationProviders); + new AllocatedEvaluatorImpl(this, + remoteManager.getMyIdentifier(), + configurationSerializer, + getJobIdentifier(), + loggingScopeFactory, + evaluatorConfigurationProviders, + jvmProcessFactory, + clrProcessFactory); LOG.log(Level.FINEST, "Firing AllocatedEvaluator event for Evaluator with ID [{0}]", evaluatorId); this.messageDispatcher.onEvaluatorAllocated(allocatedEvaluator); LOG.log(Level.FINEST, "Instantiated 'EvaluatorManager' for evaluator: [{0}]", this.getId()); @@ -175,8 +184,8 @@ public final class EvaluatorManager implements Identifiable, AutoCloseable { return this.evaluatorId; } - public void setType(final EvaluatorType type) { - this.evaluatorDescriptor.setType(type); + public void setProcess(final EvaluatorProcess process) { + this.evaluatorDescriptor.setProcess(process); } public EvaluatorDescriptor getEvaluatorDescriptor() { http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManagerFactory.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManagerFactory.java b/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManagerFactory.java index e11070b..e230b0a 100644 --- a/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManagerFactory.java +++ b/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManagerFactory.java @@ -22,8 +22,7 @@ import org.apache.reef.annotations.audience.DriverSide; import org.apache.reef.annotations.audience.Private; import org.apache.reef.driver.catalog.NodeDescriptor; import org.apache.reef.driver.catalog.ResourceCatalog; -import org.apache.reef.driver.evaluator.EvaluatorType; -import org.apache.reef.runtime.common.driver.resourcemanager.NodeDescriptorHandler; +import org.apache.reef.driver.evaluator.EvaluatorProcessFactory; import org.apache.reef.runtime.common.driver.resourcemanager.ResourceAllocationEvent; import org.apache.reef.runtime.common.driver.resourcemanager.ResourceStatusEvent; import org.apache.reef.tang.Injector; @@ -44,11 +43,13 @@ public final class EvaluatorManagerFactory { private final Injector injector; private final ResourceCatalog resourceCatalog; + private final EvaluatorProcessFactory processFactory; @Inject - EvaluatorManagerFactory(final Injector injector, final ResourceCatalog resourceCatalog, final NodeDescriptorHandler nodeDescriptorHandler) { + EvaluatorManagerFactory(final Injector injector, final ResourceCatalog resourceCatalog, final EvaluatorProcessFactory processFactory) { this.injector = injector; this.resourceCatalog = resourceCatalog; + this.processFactory = processFactory; } /** @@ -91,7 +92,7 @@ public final class EvaluatorManagerFactory { throw new RuntimeException("Unknown resource: " + resourceAllocationEvent.getNodeId()); } final EvaluatorDescriptorImpl evaluatorDescriptor = new EvaluatorDescriptorImpl(nodeDescriptor, - EvaluatorType.UNDECIDED, resourceAllocationEvent.getResourceMemory(), resourceAllocationEvent.getVirtualCores().get()); + resourceAllocationEvent.getResourceMemory(), resourceAllocationEvent.getVirtualCores().get(), processFactory.newEvaluatorProcess()); LOG.log(Level.FINEST, "Resource allocation: new evaluator id[{0}]", resourceAllocationEvent.getIdentifier()); return this.getNewEvaluatorManagerInstance(resourceAllocationEvent.getIdentifier(), evaluatorDescriptor); @@ -101,6 +102,6 @@ public final class EvaluatorManagerFactory { if (!resourceStatusEvent.getIsFromPreviousDriver().get()) { throw new RuntimeException("Invalid resourceStatusEvent, must be status for resource from previous Driver."); } - return getNewEvaluatorManagerInstance(resourceStatusEvent.getIdentifier(), new EvaluatorDescriptorImpl(null, EvaluatorType.UNDECIDED, 128, 1)); + return getNewEvaluatorManagerInstance(resourceStatusEvent.getIdentifier(), new EvaluatorDescriptorImpl(null, 128, 1, processFactory.newEvaluatorProcess())); } } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/files/RuntimePathProvider.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/files/RuntimePathProvider.java b/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/files/RuntimePathProvider.java new file mode 100644 index 0000000..dffaf7b --- /dev/null +++ b/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/files/RuntimePathProvider.java @@ -0,0 +1,29 @@ +/* + * 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.runtime.common.files; + +import org.apache.reef.tang.annotations.DefaultImplementation; + +/** + * Supplies the path to the executable for process (Driver, Evaluator) launches. + */ +@DefaultImplementation(UnixJVMPathProvider.class) +public interface RuntimePathProvider { + String getPath(); +} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/files/UnixJVMPathProvider.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/files/UnixJVMPathProvider.java b/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/files/UnixJVMPathProvider.java new file mode 100644 index 0000000..d18c8e9 --- /dev/null +++ b/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/files/UnixJVMPathProvider.java @@ -0,0 +1,35 @@ +/* + * 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.runtime.common.files; + +import javax.inject.Inject; + +/** + * Supplies the java binary's path for Unix systems based on JAVA_HOME + */ +public final class UnixJVMPathProvider implements RuntimePathProvider { + @Inject + public UnixJVMPathProvider() { + } + + @Override + public String getPath() { + return System.getenv("JAVA_HOME") + "/bin/" + "java"; + } +} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-examples-clr/src/main/java/org/apache/reef/examples/helloCLR/HelloDriver.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-examples-clr/src/main/java/org/apache/reef/examples/helloCLR/HelloDriver.java b/lang/java/reef-examples-clr/src/main/java/org/apache/reef/examples/helloCLR/HelloDriver.java index 087deb2..0578635 100644 --- a/lang/java/reef-examples-clr/src/main/java/org/apache/reef/examples/helloCLR/HelloDriver.java +++ b/lang/java/reef-examples-clr/src/main/java/org/apache/reef/examples/helloCLR/HelloDriver.java @@ -20,11 +20,13 @@ package org.apache.reef.examples.helloCLR; import org.apache.reef.driver.context.ContextConfiguration; import org.apache.reef.driver.evaluator.AllocatedEvaluator; +import org.apache.reef.driver.evaluator.CLRProcessFactory; import org.apache.reef.driver.evaluator.EvaluatorRequest; import org.apache.reef.driver.evaluator.EvaluatorRequestor; import org.apache.reef.driver.evaluator.EvaluatorType; import org.apache.reef.driver.task.TaskConfiguration; import org.apache.reef.examples.hello.HelloTask; +import org.apache.reef.driver.evaluator.CLRProcess; import org.apache.reef.tang.ClassHierarchy; import org.apache.reef.tang.Configuration; import org.apache.reef.tang.ConfigurationBuilder; @@ -52,6 +54,7 @@ public final class HelloDriver { private static final Logger LOG = Logger.getLogger(HelloDriver.class.getName()); private final EvaluatorRequestor requestor; + private final CLRProcessFactory clrProcessFactory; private int nJVMTasks = 1; // guarded by this private int nCLRTasks = 1; // guarded by this @@ -63,8 +66,10 @@ public final class HelloDriver { * @param requestor evaluator requestor object used to create new evaluator containers. */ @Inject - public HelloDriver(final EvaluatorRequestor requestor) { + public HelloDriver(final EvaluatorRequestor requestor, + final CLRProcessFactory clrProcessFactory) { this.requestor = requestor; + this.clrProcessFactory = clrProcessFactory; } /** @@ -107,7 +112,7 @@ public final class HelloDriver { */ final void onNextCLR(final AllocatedEvaluator allocatedEvaluator) { try { - allocatedEvaluator.setType(EvaluatorType.CLR); + allocatedEvaluator.setProcess(clrProcessFactory.newEvaluatorProcess()); final Configuration contextConfiguration = ContextConfiguration.CONF .set(ContextConfiguration.IDENTIFIER, "HelloREEFContext") .build(); @@ -129,7 +134,6 @@ public final class HelloDriver { */ final void onNextJVM(final AllocatedEvaluator allocatedEvaluator) { try { - allocatedEvaluator.setType(EvaluatorType.JVM); final Configuration contextConfiguration = ContextConfiguration.CONF .set(ContextConfiguration.IDENTIFIER, "HelloREEFContext") .build(); http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/HDInsightJVMPathProvider.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/HDInsightJVMPathProvider.java b/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/HDInsightJVMPathProvider.java new file mode 100644 index 0000000..d4ab0cc --- /dev/null +++ b/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/HDInsightJVMPathProvider.java @@ -0,0 +1,36 @@ +/* + * 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.runtime.hdinsight; + +import com.google.inject.Inject; +import org.apache.reef.runtime.common.files.RuntimePathProvider; + +/** + * Supplies the java binary's path for HDInsight + */ +public final class HDInsightJVMPathProvider implements RuntimePathProvider { + @Inject + public HDInsightJVMPathProvider() { + } + + @Override + public String getPath() { + return "%JAVA_HOME%/bin/java"; + } +} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/HDInsightDriverConfiguration.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/HDInsightDriverConfiguration.java b/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/HDInsightDriverConfiguration.java index f372fa1..49d3898 100644 --- a/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/HDInsightDriverConfiguration.java +++ b/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/HDInsightDriverConfiguration.java @@ -27,9 +27,11 @@ import org.apache.reef.runtime.common.driver.api.AbstractDriverRuntimeConfigurat import org.apache.reef.runtime.common.driver.api.ResourceLaunchHandler; import org.apache.reef.runtime.common.driver.api.ResourceReleaseHandler; import org.apache.reef.runtime.common.driver.api.ResourceRequestHandler; +import org.apache.reef.runtime.common.files.RuntimePathProvider; import org.apache.reef.runtime.common.files.RuntimeClasspathProvider; import org.apache.reef.runtime.common.parameters.JVMHeapSlack; import org.apache.reef.runtime.hdinsight.HDInsightClasspathProvider; +import org.apache.reef.runtime.hdinsight.HDInsightJVMPathProvider; import org.apache.reef.runtime.yarn.driver.*; import org.apache.reef.runtime.yarn.driver.parameters.JobSubmissionDirectory; import org.apache.reef.runtime.yarn.driver.parameters.YarnHeartbeatPeriod; @@ -91,5 +93,6 @@ public final class HDInsightDriverConfiguration extends ConfigurationModuleBuild .bindNamedParameter(AbstractDriverRuntimeConfiguration.EvaluatorTimeout.class, EVALUATOR_TIMEOUT) .bindNamedParameter(JVMHeapSlack.class, JVM_HEAP_SLACK) .bindImplementation(RuntimeClasspathProvider.class, HDInsightClasspathProvider.class) + .bindImplementation(RuntimePathProvider.class, HDInsightJVMPathProvider.class) .build(); } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/HDInsightRuntimeConfigurationStatic.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/HDInsightRuntimeConfigurationStatic.java b/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/HDInsightRuntimeConfigurationStatic.java index babb846..fece8e9 100644 --- a/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/HDInsightRuntimeConfigurationStatic.java +++ b/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/HDInsightRuntimeConfigurationStatic.java @@ -21,8 +21,10 @@ package org.apache.reef.runtime.hdinsight.client; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.reef.runtime.common.client.CommonRuntimeConfiguration; import org.apache.reef.runtime.common.client.api.JobSubmissionHandler; +import org.apache.reef.runtime.common.files.RuntimePathProvider; import org.apache.reef.runtime.common.files.RuntimeClasspathProvider; import org.apache.reef.runtime.hdinsight.HDInsightClasspathProvider; +import org.apache.reef.runtime.hdinsight.HDInsightJVMPathProvider; import org.apache.reef.runtime.hdinsight.client.sslhacks.DefaultClientConstructor; import org.apache.reef.tang.formats.ConfigurationModule; import org.apache.reef.tang.formats.ConfigurationModuleBuilder; @@ -41,6 +43,7 @@ public final class HDInsightRuntimeConfigurationStatic extends ConfigurationModu .bindImplementation(JobSubmissionHandler.class, HDInsightJobSubmissionHandler.class) .bindConstructor(CloseableHttpClient.class, DefaultClientConstructor.class) .bindImplementation(RuntimeClasspathProvider.class, HDInsightClasspathProvider.class) + .bindImplementation(RuntimePathProvider.class, HDInsightJVMPathProvider.class) .build(); } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/driver/ResourceManager.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/driver/ResourceManager.java b/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/driver/ResourceManager.java index 7d190cb..03fa000 100644 --- a/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/driver/ResourceManager.java +++ b/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/driver/ResourceManager.java @@ -187,27 +187,13 @@ public final class ResourceManager { } try (final LoggingScope lc = this.loggingScopeFactory.getNewLoggingScope("ResourceManager.onResourceLaunchRequest:runCommand")) { - // Assemble the command line - final LaunchCommandBuilder commandBuilder; - switch (launchRequest.getType()) { - case JVM: - commandBuilder = new JavaLaunchCommandBuilder() - .setClassPath(this.classpathProvider.getEvaluatorClasspath()); - break; - case CLR: - commandBuilder = new CLRLaunchCommandBuilder(); - break; - default: - throw new IllegalArgumentException( - "Unsupported container type: " + launchRequest.getType()); - } - final List<String> command = commandBuilder + final List<String> command = launchRequest.getProcess() .setErrorHandlerRID(this.remoteManager.getMyIdentifier()) .setLaunchID(c.getNodeID()) .setConfigurationFileName(this.fileNames.getEvaluatorConfigurationPath()) .setMemory((int) (this.jvmHeapFactor * c.getMemory())) - .build(); + .getCommandLine(); LOG.log(Level.FINEST, "Launching container: {0}", c); c.run(command); http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-runtime-mesos/src/main/java/org/apache/reef/runtime/mesos/driver/MesosResourceLaunchHandler.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-runtime-mesos/src/main/java/org/apache/reef/runtime/mesos/driver/MesosResourceLaunchHandler.java b/lang/java/reef-runtime-mesos/src/main/java/org/apache/reef/runtime/mesos/driver/MesosResourceLaunchHandler.java index b239b80..a5b5738 100644 --- a/lang/java/reef-runtime-mesos/src/main/java/org/apache/reef/runtime/mesos/driver/MesosResourceLaunchHandler.java +++ b/lang/java/reef-runtime-mesos/src/main/java/org/apache/reef/runtime/mesos/driver/MesosResourceLaunchHandler.java @@ -27,9 +27,6 @@ import org.apache.reef.runtime.common.driver.api.ResourceLaunchHandler; import org.apache.reef.runtime.common.files.ClasspathProvider; import org.apache.reef.runtime.common.files.JobJarMaker; import org.apache.reef.runtime.common.files.REEFFileNames; -import org.apache.reef.runtime.common.launch.CLRLaunchCommandBuilder; -import org.apache.reef.runtime.common.launch.JavaLaunchCommandBuilder; -import org.apache.reef.runtime.common.launch.LaunchCommandBuilder; import org.apache.reef.runtime.common.parameters.JVMHeapSlack; import org.apache.reef.runtime.common.utils.RemoteManager; import org.apache.reef.runtime.mesos.util.EvaluatorLaunch; @@ -101,24 +98,12 @@ final class MesosResourceLaunchHandler implements ResourceLaunchHandler { FileUtil.copy(localStagingFolder, fileSystem, hdfsFolder, false, new org.apache.hadoop.conf.Configuration()); // TODO: Replace REEFExecutor with a simple launch command (we only need to launch REEFExecutor) - final LaunchCommandBuilder commandBuilder; - switch (resourceLaunchEvent.getType()) { - case JVM: - commandBuilder = new JavaLaunchCommandBuilder().setClassPath(this.classpath.getEvaluatorClasspath()); - break; - case CLR: - commandBuilder = new CLRLaunchCommandBuilder(); - break; - default: - throw new IllegalArgumentException("Unsupported container type"); - } - - final List<String> command = commandBuilder + final List<String> command = resourceLaunchEvent.getProcess() .setErrorHandlerRID(this.remoteManager.getMyIdentifier()) .setLaunchID(resourceLaunchEvent.getIdentifier()) .setConfigurationFileName(this.fileNames.getEvaluatorConfigurationPath()) .setMemory((int) (this.jvmHeapFactor * this.executors.getMemory(resourceLaunchEvent.getIdentifier()))) - .build(); + .getCommandLine(); this.executors.launchEvaluator( new EvaluatorLaunch(resourceLaunchEvent.getIdentifier(), StringUtils.join(command, ' '))); http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YARNResourceLaunchHandler.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YARNResourceLaunchHandler.java b/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YARNResourceLaunchHandler.java index 8401e67..3763997 100644 --- a/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YARNResourceLaunchHandler.java +++ b/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YARNResourceLaunchHandler.java @@ -25,11 +25,7 @@ import org.apache.hadoop.yarn.api.records.ContainerLaunchContext; import org.apache.hadoop.yarn.api.records.LocalResource; import org.apache.reef.runtime.common.driver.api.ResourceLaunchEvent; import org.apache.reef.runtime.common.driver.api.ResourceLaunchHandler; -import org.apache.reef.runtime.common.files.ClasspathProvider; import org.apache.reef.runtime.common.files.REEFFileNames; -import org.apache.reef.runtime.common.launch.CLRLaunchCommandBuilder; -import org.apache.reef.runtime.common.launch.JavaLaunchCommandBuilder; -import org.apache.reef.runtime.common.launch.LaunchCommandBuilder; import org.apache.reef.runtime.common.parameters.JVMHeapSlack; import org.apache.reef.runtime.yarn.util.YarnTypes; import org.apache.reef.tang.InjectionFuture; @@ -52,7 +48,6 @@ public final class YARNResourceLaunchHandler implements ResourceLaunchHandler { private final InjectionFuture<YarnContainerManager> yarnContainerManager; private final EvaluatorSetupHelper evaluatorSetupHelper; private final REEFFileNames filenames; - private final ClasspathProvider classpath; private final double jvmHeapFactor; @Inject @@ -60,7 +55,6 @@ public final class YARNResourceLaunchHandler implements ResourceLaunchHandler { final InjectionFuture<YarnContainerManager> yarnContainerManager, final EvaluatorSetupHelper evaluatorSetupHelper, final REEFFileNames filenames, - final ClasspathProvider classpath, final @Parameter(JVMHeapSlack.class) double jvmHeapSlack) { this.jvmHeapFactor = 1.0 - jvmHeapSlack; LOG.log(Level.FINEST, "Instantiating 'YARNResourceLaunchHandler'"); @@ -68,7 +62,6 @@ public final class YARNResourceLaunchHandler implements ResourceLaunchHandler { this.yarnContainerManager = yarnContainerManager; this.evaluatorSetupHelper = evaluatorSetupHelper; this.filenames = filenames; - this.classpath = classpath; LOG.log(Level.FINE, "Instantiated 'YARNResourceLaunchHandler'"); } @@ -83,28 +76,14 @@ public final class YARNResourceLaunchHandler implements ResourceLaunchHandler { final Map<String, LocalResource> localResources = this.evaluatorSetupHelper.getResources(resourceLaunchEvent); - final LaunchCommandBuilder commandBuilder; - switch (resourceLaunchEvent.getType()) { - case JVM: - commandBuilder = new JavaLaunchCommandBuilder() - .setClassPath(this.classpath.getEvaluatorClasspath()); - break; - case CLR: - commandBuilder = new CLRLaunchCommandBuilder(); - break; - default: - throw new IllegalArgumentException( - "Unsupported container type: " + resourceLaunchEvent.getType()); - } - - final List<String> command = commandBuilder + final List<String> command = resourceLaunchEvent.getProcess() .setErrorHandlerRID(resourceLaunchEvent.getRemoteId()) .setLaunchID(resourceLaunchEvent.getIdentifier()) .setConfigurationFileName(this.filenames.getEvaluatorConfigurationPath()) .setMemory((int) (this.jvmHeapFactor * container.getResource().getMemory())) .setStandardErr(ApplicationConstants.LOG_DIR_EXPANSION_VAR + "/" + this.filenames.getEvaluatorStderrFileName()) .setStandardOut(ApplicationConstants.LOG_DIR_EXPANSION_VAR + "/" + this.filenames.getEvaluatorStdoutFileName()) - .build(); + .getCommandLine(); if (LOG.isLoggable(Level.FINEST)) { LOG.log(Level.FINEST, http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/AvroEvaluatorInfoSerializer.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/AvroEvaluatorInfoSerializer.java b/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/AvroEvaluatorInfoSerializer.java index 8a569f6..85bda5b 100644 --- a/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/AvroEvaluatorInfoSerializer.java +++ b/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/AvroEvaluatorInfoSerializer.java @@ -65,7 +65,7 @@ public class AvroEvaluatorInfoSerializer implements EvaluatorInfoSerializer { nodeName = evaluatorDescriptor.getNodeDescriptor().getName(); address = evaluatorDescriptor.getNodeDescriptor().getInetSocketAddress(); memory = evaluatorDescriptor.getMemory(); - type = evaluatorDescriptor.getType().toString(); + type = evaluatorDescriptor.getProcess().getType().toString(); } evaluatorsInfo.add(AvroEvaluatorInfo.newBuilder() http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerReefEventHandler.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerReefEventHandler.java b/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerReefEventHandler.java index d108813..49f7d0b 100644 --- a/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerReefEventHandler.java +++ b/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerReefEventHandler.java @@ -259,7 +259,7 @@ public final class HttpServerReefEventHandler implements HttpHandler { writer.write("<br/>"); writer.println("Evaluator Core: " + evaluatorDescriptor.getNumberOfCores()); writer.write("<br/>"); - writer.println("Evaluator Type: " + evaluatorDescriptor.getType()); + writer.println("Evaluator Type: " + evaluatorDescriptor.getProcess()); writer.write("<br/>"); } else { writer.println("Incorrect Evaluator Id: " + id); http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-webserver/src/test/java/org/apache/reef/webserver/TestAvroSerializerForHttp.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-webserver/src/test/java/org/apache/reef/webserver/TestAvroSerializerForHttp.java b/lang/java/reef-webserver/src/test/java/org/apache/reef/webserver/TestAvroSerializerForHttp.java index 3ff5efb..e6585fe 100644 --- a/lang/java/reef-webserver/src/test/java/org/apache/reef/webserver/TestAvroSerializerForHttp.java +++ b/lang/java/reef-webserver/src/test/java/org/apache/reef/webserver/TestAvroSerializerForHttp.java @@ -20,8 +20,11 @@ package org.apache.reef.webserver; import org.apache.reef.driver.catalog.NodeDescriptor; import org.apache.reef.driver.catalog.RackDescriptor; +import org.apache.reef.driver.evaluator.CLRProcess; +import org.apache.reef.driver.evaluator.CLRProcessFactory; import org.apache.reef.driver.evaluator.EvaluatorDescriptor; -import org.apache.reef.driver.evaluator.EvaluatorType; +import org.apache.reef.driver.evaluator.EvaluatorProcess; +import org.apache.reef.driver.evaluator.EvaluatorProcessFactory; import org.apache.reef.tang.Tang; import org.apache.reef.tang.exceptions.InjectionException; import org.apache.reef.tang.formats.ConfigurationModule; @@ -98,15 +101,19 @@ public class TestAvroSerializerForHttp { static final ConfigurationModule CONF = new EvaluatorDescriptorConfig() .bindImplementation(EvaluatorDescriptor.class, EvaluatorDescriptorMock.class) .bindImplementation(NodeDescriptor.class, NodeDescriptorMock.class) + .bindImplementation(EvaluatorProcessFactory.class, CLRProcessFactory.class) .build(); } static class EvaluatorDescriptorMock implements EvaluatorDescriptor { final NodeDescriptor nodeDescriptor; + final EvaluatorProcessFactory evaluatorProcessFactory; @Inject - EvaluatorDescriptorMock(final NodeDescriptor nodeDescriptor) { + EvaluatorDescriptorMock(final NodeDescriptor nodeDescriptor, + final EvaluatorProcessFactory evaluatorProcessFactory) { this.nodeDescriptor = nodeDescriptor; + this.evaluatorProcessFactory = evaluatorProcessFactory; } /** @@ -118,11 +125,11 @@ public class TestAvroSerializerForHttp { } /** - * @return the type of Evaluator. + * @return the Evaluator process. */ @Override - public EvaluatorType getType() { - return EvaluatorType.CLR; + public EvaluatorProcess getProcess() { + return evaluatorProcessFactory.newEvaluatorProcess(); } /** http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/20050eb6/lang/java/reef-webserver/src/test/java/org/apache/reef/webserver/TestReefEventStateManager.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-webserver/src/test/java/org/apache/reef/webserver/TestReefEventStateManager.java b/lang/java/reef-webserver/src/test/java/org/apache/reef/webserver/TestReefEventStateManager.java index bcd4cf5..77bd280 100644 --- a/lang/java/reef-webserver/src/test/java/org/apache/reef/webserver/TestReefEventStateManager.java +++ b/lang/java/reef-webserver/src/test/java/org/apache/reef/webserver/TestReefEventStateManager.java @@ -20,8 +20,11 @@ package org.apache.reef.webserver; import org.apache.reef.driver.catalog.NodeDescriptor; import org.apache.reef.driver.catalog.RackDescriptor; +import org.apache.reef.driver.evaluator.CLRProcess; +import org.apache.reef.driver.evaluator.CLRProcessFactory; import org.apache.reef.driver.evaluator.EvaluatorDescriptor; -import org.apache.reef.driver.evaluator.EvaluatorType; +import org.apache.reef.driver.evaluator.EvaluatorProcess; +import org.apache.reef.driver.evaluator.EvaluatorProcessFactory; import org.apache.reef.runtime.common.driver.api.AbstractDriverRuntimeConfiguration; import org.apache.reef.runtime.common.launch.REEFMessageCodec; import org.apache.reef.tang.Configuration; @@ -51,6 +54,7 @@ public class TestReefEventStateManager { final Configuration configuration = tang.newConfigurationBuilder() .bindImplementation(EvaluatorDescriptor.class, MockEvaluatorDescriptor.class) .bindImplementation(NodeDescriptor.class, MockNodeDescriptor.class) + .bindImplementation(EvaluatorProcessFactory.class, CLRProcessFactory.class) .bindNamedParameter(RemoteConfiguration.ManagerName.class, "REEF_TEST_REMOTE_MANAGER") .bindNamedParameter(RemoteConfiguration.MessageCodec.class, REEFMessageCodec.class) .bindNamedParameter(AbstractDriverRuntimeConfiguration.JobIdentifier.class, "my job") @@ -92,10 +96,13 @@ public class TestReefEventStateManager { final class MockEvaluatorDescriptor implements EvaluatorDescriptor { final private NodeDescriptor nodeDescriptor; + final EvaluatorProcessFactory evaluatorProcessFactory; @Inject - public MockEvaluatorDescriptor(final NodeDescriptor nodeDescriptor) { + public MockEvaluatorDescriptor(final NodeDescriptor nodeDescriptor, + final EvaluatorProcessFactory evaluatorProcessFactory) { this.nodeDescriptor = nodeDescriptor; + this.evaluatorProcessFactory = evaluatorProcessFactory; } @Override @@ -104,8 +111,8 @@ final class MockEvaluatorDescriptor implements EvaluatorDescriptor { } @Override - public EvaluatorType getType() { - return EvaluatorType.CLR; + public EvaluatorProcess getProcess() { + return evaluatorProcessFactory.newEvaluatorProcess(); } @Override
