You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@reef.apache.org by we...@apache.org on 2014/10/23 02:04:13 UTC
[42/51] [abbrv] [partial] Initial merge of Wake,
Tang and REEF into one repository and project
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/io/serialization/Serializer.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/io/serialization/Serializer.java b/reef-common/src/main/java/com/microsoft/reef/io/serialization/Serializer.java
deleted file mode 100644
index 2a8a2f2..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/io/serialization/Serializer.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.io.serialization;
-
-import com.microsoft.reef.io.Accumulable;
-
-/**
- * Stream-based multi-object serialization interface. Implementations of this
- * interface should take an OutType as a constructor parameter.
- *
- * @param <ObjectType>
- * @param <OutType>
- */
-public interface Serializer<ObjectType, OutType> {
- /**
- * Serialize a stream of objects.
- *
- * @param arg
- * @return
- */
- public Accumulable<ObjectType> create(OutType arg);
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/DriverRestartCompleted.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/DriverRestartCompleted.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/DriverRestartCompleted.java
deleted file mode 100644
index a8120d7..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/DriverRestartCompleted.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.runtime.common;
-
-import com.microsoft.wake.time.Time;
-
-public final class DriverRestartCompleted extends Time {
-
- public DriverRestartCompleted(final long timestamp) {
- super(timestamp);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/Launcher.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/Launcher.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/Launcher.java
deleted file mode 100644
index 8d3a4de..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/Launcher.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.runtime.common;
-
-import com.microsoft.reef.runtime.common.launch.LaunchClass;
-import com.microsoft.reef.runtime.common.launch.REEFErrorHandler;
-import com.microsoft.reef.runtime.common.launch.REEFMessageCodec;
-import com.microsoft.reef.runtime.common.launch.parameters.ClockConfigurationPath;
-import com.microsoft.reef.runtime.common.launch.parameters.ErrorHandlerRID;
-import com.microsoft.reef.runtime.common.launch.parameters.LaunchID;
-import com.microsoft.reef.util.EnvironmentUtils;
-import com.microsoft.reef.util.logging.LoggingSetup;
-import com.microsoft.tang.Configuration;
-import com.microsoft.tang.Injector;
-import com.microsoft.tang.JavaConfigurationBuilder;
-import com.microsoft.tang.Tang;
-import com.microsoft.tang.exceptions.BindException;
-import com.microsoft.tang.exceptions.InjectionException;
-import com.microsoft.tang.formats.CommandLine;
-import com.microsoft.wake.remote.RemoteConfiguration;
-import org.apache.reef.util.ThreadLogger;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * The main entrance point into any REEF process. It is mostly instantiating LaunchClass and calling .run() on it.
- */
-public final class Launcher {
-
- private final static Logger LOG = Logger.getLogger(Launcher.class.getName());
-
- static {
- LoggingSetup.setupCommonsLogging();
- }
-
- private Launcher() {
- }
-
- /**
- * Parse command line options of the launcher.
- *
- * @param args Command line as passed into main().
- * @return TANG configuration object.
- */
- private static Configuration processCommandLine(
- final String[] args) throws BindException, IOException, InjectionException {
-
- final JavaConfigurationBuilder commandLineBuilder =
- Tang.Factory.getTang().newConfigurationBuilder();
-
- new CommandLine(commandLineBuilder)
- .registerShortNameOfClass(ClockConfigurationPath.class)
- .registerShortNameOfClass(ErrorHandlerRID.class)
- .registerShortNameOfClass(LaunchID.class)
- .processCommandLine(args);
-
- return commandLineBuilder
- // Bind the wake error handler
- .bindNamedParameter(RemoteConfiguration.ErrorHandler.class, REEFErrorHandler.class)
- .bindNamedParameter(RemoteConfiguration.ManagerName.class, "REEF_LAUNCHER")
- // Bind the wake codec
- .bindNamedParameter(RemoteConfiguration.MessageCodec.class, REEFMessageCodec.class)
- .build();
- }
-
- private static void fail(final String msg, final Throwable t) {
- LOG.log(Level.SEVERE, msg, t);
- throw new RuntimeException(msg, t);
- }
-
-
- /**
- * Launches a REEF client process (Driver or Evaluator).
- *
- * @param args
- * @throws Exception
- */
- public static void main(final String[] args) {
- LOG.log(Level.FINE, "Launcher started with user name [{0}]", System.getProperty("user.name"));
-
- LOG.log(Level.FINE, "Launcher started. Assertions are {0} in this process.",
- EnvironmentUtils.areAssertionsEnabled() ? "ENABLED" : "DISABLED");
- Injector injector = null;
- try {
- injector = Tang.Factory.getTang().newInjector(processCommandLine(args));
- } catch (final BindException | IOException | InjectionException e) {
- fail("Error in parsing the command line", e);
- }
-
- try (final LaunchClass lc = injector.getInstance(LaunchClass.class)) {
- LOG.log(Level.FINE, "Launcher starting");
- lc.run();
- LOG.log(Level.FINE, "Launcher exiting");
- } catch (final Throwable throwable) {
- fail("Unable to run LaunchClass", throwable);
- }
-
- LOG.log(Level.INFO, "Exiting Launcher.main()");
- if (LOG.isLoggable(Level.FINEST)) {
- LOG.log(Level.FINEST, ThreadLogger.getFormattedThreadList("Threads running after Launcher.close():"));
- }
- System.exit(0);
- if (LOG.isLoggable(Level.FINEST)) {
- LOG.log(Level.FINEST, ThreadLogger.getFormattedThreadList("Threads running after System.exit():"));
- }
- }
-
- /**
- * Pass values of the properties specified in the propNames array as <code>-D...</code>
- * command line parameters. Currently used only to pass logging configuration to child JVMs processes.
- *
- * @param vargs List of command line parameters to append to.
- * @param copyNull create an empty parameter if the property is missing in current process.
- * @param propNames property names.
- */
- public static void propagateProperties(
- final Collection<String> vargs, final boolean copyNull, final String... propNames) {
- for (final String propName : propNames) {
- final String propValue = System.getProperty(propName);
- if (propValue == null || propValue.isEmpty()) {
- if (copyNull) {
- vargs.add("-D" + propName);
- }
- } else {
- vargs.add(String.format("-D%s=%s", propName, propValue));
- }
- }
- }
-
- /**
- * Same as above, but with copyNull == false by default.
- */
- public static void propagateProperties(
- final Collection<String> vargs, final String... propNames) {
- propagateProperties(vargs, false, propNames);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/ClientWireUp.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/ClientWireUp.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/ClientWireUp.java
deleted file mode 100644
index 1823673..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/ClientWireUp.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.runtime.common.client;
-
-
-import com.microsoft.reef.annotations.audience.ClientSide;
-import com.microsoft.reef.annotations.audience.Private;
-import com.microsoft.reef.proto.ReefServiceProtos;
-import com.microsoft.reef.runtime.common.client.parameters.ClientPresent;
-import com.microsoft.reef.runtime.common.utils.RemoteManager;
-import com.microsoft.reef.util.Optional;
-import com.microsoft.tang.annotations.Parameter;
-
-import javax.inject.Inject;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Used on the Client side to setup event handlers and such.
- */
-@ClientSide
-@Private
-final class ClientWireUp {
- private static final Logger LOG = Logger.getLogger(ClientWireUp.class.getName());
- private final RuntimeErrorProtoHandler runtimeErrorProtoHandler;
- private final JobStatusMessageHandler jobStatusMessageHandler;
- private final Optional<RemoteManager> remoteManager;
- private final boolean isClientPresent;
- private boolean isWired = false;
-
- @Inject
- ClientWireUp(final RemoteManager remoteManager,
- final @Parameter(ClientPresent.class) String clientPresent,
- final RuntimeErrorProtoHandler runtimeErrorProtoHandler,
- final JobStatusMessageHandler jobStatusMessageHandler) {
- this.remoteManager = Optional.ofNullable(remoteManager);
- this.runtimeErrorProtoHandler = runtimeErrorProtoHandler;
- this.jobStatusMessageHandler = jobStatusMessageHandler;
- this.isClientPresent = clientPresent.equals(ClientPresent.YES);
- LOG.log(Level.FINE, "Instantiated 'ClientWireUp'. Client present: " + this.isClientPresent());
- }
-
- @Inject
- ClientWireUp(final @Parameter(ClientPresent.class) String clientPresent,
- final RuntimeErrorProtoHandler runtimeErrorProtoHandler,
- final JobStatusMessageHandler jobStatusMessageHandler) {
- this(null, clientPresent, runtimeErrorProtoHandler, jobStatusMessageHandler);
- }
-
- synchronized void performWireUp() {
- if (this.isWired) {
- throw new IllegalStateException("performWireUp is only to be called once.");
- }
- if (this.remoteManager.isPresent()) {
- LOG.log(Level.FINEST, "Wiring up communications channels to the Driver.");
- final RemoteManager rm = this.remoteManager.get();
- rm.registerHandler(ReefServiceProtos.RuntimeErrorProto.class, this.runtimeErrorProtoHandler);
- rm.registerHandler(ReefServiceProtos.JobStatusProto.class, this.jobStatusMessageHandler);
- LOG.log(Level.FINE, "Wired up communications channels to the Driver.");
- }
- this.isWired = true;
- }
-
- synchronized boolean isClientPresent() {
- return this.isClientPresent;
- }
-
- synchronized String getRemoteManagerIdentifier() {
- if (!this.isClientPresent() || !this.remoteManager.isPresent()) {
- throw new RuntimeException("No need to setup the remote manager.");
- } else {
- return this.remoteManager.get().getMyIdentifier();
- }
- }
-
- /**
- * Closes the remote manager, if there was one.
- */
- synchronized void close() {
- if (this.remoteManager.isPresent()) {
- try {
- this.remoteManager.get().close();
- } catch (final Exception e) {
- LOG.log(Level.WARNING, "Exception while shutting down the RemoteManager.", e);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/CommonClientConfigurationModule.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/CommonClientConfigurationModule.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/CommonClientConfigurationModule.java
deleted file mode 100644
index 16cd05d..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/CommonClientConfigurationModule.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.runtime.common.client;
-
-import com.microsoft.tang.formats.ConfigurationModule;
-import com.microsoft.tang.formats.ConfigurationModuleBuilder;
-
-
-public class CommonClientConfigurationModule extends ConfigurationModuleBuilder {
- public final static ConfigurationModule CONF = new CommonClientConfigurationModule()
- .build();
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/CompletedJobImpl.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/CompletedJobImpl.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/CompletedJobImpl.java
deleted file mode 100644
index 7c95a4b..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/CompletedJobImpl.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.runtime.common.client;
-
-import com.microsoft.reef.annotations.audience.ClientSide;
-import com.microsoft.reef.annotations.audience.Private;
-import com.microsoft.reef.client.CompletedJob;
-
-/**
- * An implementation of CompletedJob
- */
-@ClientSide
-@Private
-final class CompletedJobImpl implements CompletedJob {
- private final String jobId;
-
- CompletedJobImpl(final String jobId) {
- this.jobId = jobId;
- }
-
- @Override
- public String getId() {
- return this.jobId;
- }
-
- @Override
- public String toString() {
- return "CompletedJob{'" + jobId + "'}";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/JobStatusMessageHandler.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/JobStatusMessageHandler.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/JobStatusMessageHandler.java
deleted file mode 100644
index ec85721..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/JobStatusMessageHandler.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.runtime.common.client;
-
-import com.microsoft.reef.annotations.audience.ClientSide;
-import com.microsoft.reef.annotations.audience.Private;
-import com.microsoft.reef.proto.ReefServiceProtos;
-import com.microsoft.wake.EventHandler;
-import com.microsoft.wake.remote.RemoteMessage;
-
-import javax.inject.Inject;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * A Handler for JobStatus messages from running jobs
- */
-@ClientSide
-@Private
-final class JobStatusMessageHandler implements EventHandler<RemoteMessage<ReefServiceProtos.JobStatusProto>> {
- private final Logger LOG = Logger.getLogger(JobStatusMessageHandler.class.getName());
- private final RunningJobs runningJobs;
-
- @Inject
- JobStatusMessageHandler(final RunningJobs runningJobs) {
- this.runningJobs = runningJobs;
- LOG.log(Level.FINE, "Instantiated 'JobStatusMessageHandler'");
- }
-
- @Override
- public void onNext(RemoteMessage<ReefServiceProtos.JobStatusProto> jobStatusProtoRemoteMessage) {
- this.runningJobs.onJobStatusMessage(jobStatusProtoRemoteMessage);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/JobSubmissionHelper.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/JobSubmissionHelper.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/JobSubmissionHelper.java
deleted file mode 100644
index 74ac817..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/JobSubmissionHelper.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.runtime.common.client;
-
-import com.microsoft.reef.client.REEF;
-import com.microsoft.reef.driver.parameters.*;
-import com.microsoft.reef.proto.ClientRuntimeProtocol;
-import com.microsoft.reef.proto.ReefServiceProtos;
-import com.microsoft.reef.util.JARFileMaker;
-import com.microsoft.tang.Configuration;
-import com.microsoft.tang.Injector;
-import com.microsoft.tang.Tang;
-import com.microsoft.tang.exceptions.InjectionException;
-import com.microsoft.tang.formats.ConfigurationSerializer;
-
-import javax.inject.Inject;
-import java.io.File;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.nio.file.Files;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Shared code between job submission with and without client
- */
-final class JobSubmissionHelper {
-
- static {
- System.out.println(
- "\nPowered by\n" +
- " ___________ ______ ______ _______\n" +
- " / ______ / / ___/ / ___/ / ____/\n" +
- " / _____/ / /__ / /__ / /___\n" +
- " / /\\ \\ / ___/ / ___/ / ____/\n" +
- " / / \\ \\ / /__ / /__ / /\n" +
- "/__/ \\__\\ /_____/ /_____/ /__/\n\n" +
- "From Microsoft CISL\n"
- );
- }
-
- private static final Logger LOG = Logger.getLogger(JobSubmissionHelper.class.getName());
-
- private final ConfigurationSerializer configurationSerializer;
-
- @Inject
- JobSubmissionHelper(ConfigurationSerializer configurationSerializer) {
- this.configurationSerializer = configurationSerializer;
- }
-
- /**
- * Fils out a JobSubmissionProto based on the driver configuration given.
- *
- * @param driverConfiguration
- * @return
- * @throws InjectionException
- * @throws IOException
- */
- final ClientRuntimeProtocol.JobSubmissionProto.Builder getJobsubmissionProto(final Configuration driverConfiguration) throws InjectionException, IOException {
- final Injector injector = Tang.Factory.getTang().newInjector(driverConfiguration);
-
- final ClientRuntimeProtocol.JobSubmissionProto.Builder jbuilder = ClientRuntimeProtocol.JobSubmissionProto.newBuilder()
- .setIdentifier(injector.getNamedInstance(DriverIdentifier.class))
- .setDriverMemory(injector.getNamedInstance(DriverMemory.class))
- .setUserName(System.getProperty("user.name"))
- .setConfiguration(configurationSerializer.toString(driverConfiguration));
-
-
- for (final String globalFileName : injector.getNamedInstance(JobGlobalFiles.class)) {
- LOG.log(Level.FINEST, "Adding global file: {0}", globalFileName);
- jbuilder.addGlobalFile(getFileResourceProto(globalFileName, ReefServiceProtos.FileType.PLAIN));
- }
-
- for (final String globalLibraryName : injector.getNamedInstance(JobGlobalLibraries.class)) {
- LOG.log(Level.FINEST, "Adding global library: {0}", globalLibraryName);
- jbuilder.addGlobalFile(getFileResourceProto(globalLibraryName, ReefServiceProtos.FileType.LIB));
- }
-
- for (final String localFileName : injector.getNamedInstance(DriverLocalFiles.class)) {
- LOG.log(Level.FINEST, "Adding local file: {0}", localFileName);
- jbuilder.addLocalFile(getFileResourceProto(localFileName, ReefServiceProtos.FileType.PLAIN));
- }
-
- for (final String localLibraryName : injector.getNamedInstance(DriverLocalLibraries.class)) {
- LOG.log(Level.FINEST, "Adding local library: {0}", localLibraryName);
- jbuilder.addLocalFile(getFileResourceProto(localLibraryName, ReefServiceProtos.FileType.LIB));
- }
-
- return jbuilder;
- }
-
- /**
- * Turns a pathname into the right protocol for job submission.
- *
- * @param fileName
- * @param type
- * @return
- * @throws IOException
- */
- private ReefServiceProtos.FileResourceProto getFileResourceProto(final String fileName, final ReefServiceProtos.FileType type) throws IOException {
- File file = new File(fileName);
- if (file.exists()) {
- // It is a local file and can be added.
- if (file.isDirectory()) {
- // If it is a directory, create a JAR file of it and add that instead.
- file = toJar(file);
- }
- return ReefServiceProtos.FileResourceProto.newBuilder()
- .setName(file.getName())
- .setPath(file.getPath())
- .setType(type)
- .build();
- } else {
- // The file isn't in the local filesytem. Assume that the file is actually a URI.
- // We then assume that the underlying resource manager knows how to deal with it.
- try {
- final URI uri = new URI(fileName);
- final String path = uri.getPath();
- final String name = path.substring(path.lastIndexOf('/') + 1);
- return ReefServiceProtos.FileResourceProto.newBuilder()
- .setName(name)
- .setPath(uri.toString())
- .setType(type)
- .build();
- } catch (final URISyntaxException e) {
- throw new IOException("Unable to parse URI.", e);
- }
- }
- }
-
- /**
- * Turns temporary folder "foo" into a jar file "foo.jar"
- *
- * @param file
- * @return
- * @throws IOException
- */
- private File toJar(final File file) throws IOException {
- final File tempFolder = Files.createTempDirectory("reef-tmp-tempFolder").toFile();
- final File jarFile = File.createTempFile(file.getCanonicalFile().getName(), ".jar", tempFolder);
- LOG.log(Level.FINEST, "Adding contents of folder {0} to {1}", new Object[]{file, jarFile});
- try (final JARFileMaker jarMaker = new JARFileMaker(jarFile)) {
- jarMaker.addChildren(file);
- }
- return jarFile;
- }
-
- /**
- * @return the version string for REEF.
- */
- String getVersion() {
- return REEF.REEF_VERSION;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/REEFImplementation.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/REEFImplementation.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/REEFImplementation.java
deleted file mode 100644
index 4db4ed3..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/REEFImplementation.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.runtime.common.client;
-
-import com.microsoft.reef.annotations.Provided;
-import com.microsoft.reef.annotations.audience.ClientSide;
-import com.microsoft.reef.annotations.audience.Private;
-import com.microsoft.reef.client.REEF;
-import com.microsoft.reef.proto.ClientRuntimeProtocol.JobSubmissionProto;
-import com.microsoft.reef.runtime.common.client.api.JobSubmissionHandler;
-import com.microsoft.reef.runtime.common.launch.parameters.ErrorHandlerRID;
-import com.microsoft.tang.Configuration;
-import com.microsoft.tang.annotations.Name;
-import com.microsoft.tang.annotations.NamedParameter;
-
-import javax.inject.Inject;
-import java.util.logging.Logger;
-
-@ClientSide
-@Provided
-@Private
-public final class REEFImplementation implements REEF {
-
- private final static Logger LOG = Logger.getLogger(REEFImplementation.class.getName());
-
- private final JobSubmissionHandler jobSubmissionHandler;
- private final RunningJobs runningJobs;
- private final JobSubmissionHelper jobSubmissionHelper;
- private final ClientWireUp clientWireUp;
-
- /**
- * @param jobSubmissionHandler
- * @param runningJobs
- * @param jobSubmissionHelper
- * @param jobStatusMessageHandler is passed only to make sure it is instantiated
- * @param clientWireUp
- */
- @Inject
- REEFImplementation(final JobSubmissionHandler jobSubmissionHandler,
- final RunningJobs runningJobs,
- final JobSubmissionHelper jobSubmissionHelper,
- final JobStatusMessageHandler jobStatusMessageHandler,
- final ClientWireUp clientWireUp) {
- this.jobSubmissionHandler = jobSubmissionHandler;
- this.runningJobs = runningJobs;
- this.jobSubmissionHelper = jobSubmissionHelper;
- this.clientWireUp = clientWireUp;
- clientWireUp.performWireUp();
- }
-
- @Override
- public final void close() {
- this.runningJobs.closeAllJobs();
- this.clientWireUp.close();
- }
-
- @Override
- public void submit(final Configuration driverConf) {
- final JobSubmissionProto submissionMessage;
- try {
- if (this.clientWireUp.isClientPresent()) {
- submissionMessage = this.jobSubmissionHelper.getJobsubmissionProto(driverConf)
- .setRemoteId(this.clientWireUp.getRemoteManagerIdentifier())
- .build();
- } else {
- submissionMessage = this.jobSubmissionHelper.getJobsubmissionProto(driverConf)
- .setRemoteId(ErrorHandlerRID.NONE)
- .build();
- }
- } catch (final Exception e) {
- throw new RuntimeException("Exception while processing driver configuration.", e);
- }
-
- this.jobSubmissionHandler.onNext(submissionMessage);
- }
-
- @Override
- public String getVersion() {
- return this.jobSubmissionHelper.getVersion();
- }
-
-
- @NamedParameter(doc = "The driver remote identifier.")
- public final static class DriverRemoteIdentifier implements Name<String> {
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/RunningJobImpl.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/RunningJobImpl.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/RunningJobImpl.java
deleted file mode 100644
index 9ce7130..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/RunningJobImpl.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.runtime.common.client;
-
-import com.google.protobuf.ByteString;
-import com.microsoft.reef.annotations.audience.ClientSide;
-import com.microsoft.reef.annotations.audience.Private;
-import com.microsoft.reef.client.CompletedJob;
-import com.microsoft.reef.client.FailedJob;
-import com.microsoft.reef.client.JobMessage;
-import com.microsoft.reef.client.RunningJob;
-import com.microsoft.reef.client.parameters.JobCompletedHandler;
-import com.microsoft.reef.client.parameters.JobFailedHandler;
-import com.microsoft.reef.client.parameters.JobMessageHandler;
-import com.microsoft.reef.client.parameters.JobRunningHandler;
-import com.microsoft.reef.driver.parameters.DriverIdentifier;
-import com.microsoft.reef.proto.ClientRuntimeProtocol.JobControlProto;
-import com.microsoft.reef.proto.ClientRuntimeProtocol.Signal;
-import com.microsoft.reef.proto.ReefServiceProtos;
-import com.microsoft.reef.proto.ReefServiceProtos.JobStatusProto;
-import com.microsoft.reef.runtime.common.utils.ExceptionCodec;
-import com.microsoft.reef.runtime.common.utils.RemoteManager;
-import com.microsoft.reef.util.Optional;
-import com.microsoft.tang.annotations.Parameter;
-import com.microsoft.wake.EventHandler;
-
-import javax.inject.Inject;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Implementation of RunningJob.
- */
-@ClientSide
-@Private
-public final class RunningJobImpl implements RunningJob, EventHandler<JobStatusProto> {
-
- private static final Logger LOG = Logger.getLogger(RunningJob.class.getName());
-
- private final String jobId;
-
- private final EventHandler<JobControlProto> jobControlHandler;
- private final EventHandler<RunningJob> runningJobEventHandler;
- private final EventHandler<CompletedJob> completedJobEventHandler;
- private final EventHandler<FailedJob> failedJobEventHandler;
- private final EventHandler<JobMessage> jobMessageEventHandler;
- private final ExceptionCodec exceptionCodec;
-
- @Inject
- RunningJobImpl(final RemoteManager remoteManager,
- final @Parameter(DriverIdentifier.class) String driverIdentifier,
- final @Parameter(REEFImplementation.DriverRemoteIdentifier.class) String driverRID,
- final @Parameter(JobRunningHandler.class) EventHandler<RunningJob> runningJobEventHandler,
- final @Parameter(JobCompletedHandler.class) EventHandler<CompletedJob> completedJobEventHandler,
- final @Parameter(JobFailedHandler.class) EventHandler<FailedJob> failedJobEventHandler,
- final @Parameter(JobMessageHandler.class) EventHandler<JobMessage> jobMessageEventHandler,
- final ExceptionCodec exceptionCodec) {
-
- this.jobId = driverIdentifier;
- this.runningJobEventHandler = runningJobEventHandler;
- this.completedJobEventHandler = completedJobEventHandler;
- this.failedJobEventHandler = failedJobEventHandler;
- this.jobMessageEventHandler = jobMessageEventHandler;
- this.exceptionCodec = exceptionCodec;
- this.jobControlHandler = remoteManager.getHandler(driverRID, JobControlProto.class);
-
- this.runningJobEventHandler.onNext(this);
- LOG.log(Level.FINE, "Instantiated 'RunningJobImpl'");
- }
-
- @Override
- public synchronized void close() {
- this.jobControlHandler.onNext(
- JobControlProto.newBuilder()
- .setIdentifier(this.jobId)
- .setSignal(Signal.SIG_TERMINATE)
- .build()
- );
- }
-
- @Override
- public synchronized void close(final byte[] message) {
- this.jobControlHandler.onNext(
- JobControlProto.newBuilder()
- .setIdentifier(this.jobId)
- .setSignal(Signal.SIG_TERMINATE)
- .setMessage(ByteString.copyFrom(message))
- .build()
- );
- }
-
- @Override
- public String getId() {
- return this.jobId;
- }
-
- @Override
- public synchronized void send(final byte[] message) {
- this.jobControlHandler.onNext(
- JobControlProto.newBuilder()
- .setIdentifier(this.jobId)
- .setMessage(ByteString.copyFrom(message))
- .build()
- );
- }
-
- @Override
- public synchronized void onNext(final JobStatusProto value) {
-
- final ReefServiceProtos.State state = value.getState();
- LOG.log(Level.FINEST, "Received job status: {0} from {1}",
- new Object[]{state, value.getIdentifier()});
-
- if (value.hasMessage()) {
- this.jobMessageEventHandler.onNext(
- new JobMessage(getId(), value.getMessage().toByteArray()));
- }
- if (state == ReefServiceProtos.State.DONE) {
- this.completedJobEventHandler.onNext(new CompletedJobImpl(this.getId()));
- } else if (state == ReefServiceProtos.State.FAILED) {
- this.onJobFailure(value);
- }
- }
-
- /**
- * Inform the client of a failed job.
- *
- * @param jobStatusProto
- */
- private synchronized void onJobFailure(final JobStatusProto jobStatusProto) {
- assert (jobStatusProto.getState() == ReefServiceProtos.State.FAILED);
-
- final String id = this.jobId;
- final Optional<byte[]> data = jobStatusProto.hasException() ?
- Optional.of(jobStatusProto.getException().toByteArray()) :
- Optional.<byte[]>empty();
- final Optional<Throwable> cause = this.exceptionCodec.fromBytes(data);
-
- final String message = cause.isPresent() ?
- cause.get().getMessage() :
- "No Message sent by the Job";
- final Optional<String> description = Optional.of(message);
-
- final FailedJob failedJob = new FailedJob(id, message, description, cause, data);
- this.failedJobEventHandler.onNext(failedJob);
- }
-
- @Override
- public String toString() {
- return "RunningJob{'" + this.jobId + "'}";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/RunningJobs.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/RunningJobs.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/RunningJobs.java
deleted file mode 100644
index eea5704..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/RunningJobs.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.runtime.common.client;
-
-import com.microsoft.reef.annotations.audience.ClientSide;
-import com.microsoft.reef.annotations.audience.Private;
-import com.microsoft.reef.proto.ReefServiceProtos;
-import com.microsoft.tang.annotations.DefaultImplementation;
-import com.microsoft.wake.remote.RemoteMessage;
-
-/**
- * Manages the RunningJobs a client knows about
- */
-@Private
-@ClientSide
-@DefaultImplementation(RunningJobsImpl.class)
-interface RunningJobs {
-
- /**
- * Closes all registered jobs forcefully.
- */
- public void closeAllJobs();
-
- /**
- * Processes a status message from a Job. If the Job is already known, the message will be passed on. If it is a
- * first message, a new RunningJob instance will be created for it.
- *
- * @param message
- */
- public void onJobStatusMessage(final RemoteMessage<ReefServiceProtos.JobStatusProto> message);
-
- /**
- * Processes a error message from the resource manager.
- *
- * @param runtimeFailure
- */
- public void onRuntimeErrorMessage(final RemoteMessage<ReefServiceProtos.RuntimeErrorProto> runtimeFailure);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/RunningJobsImpl.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/RunningJobsImpl.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/RunningJobsImpl.java
deleted file mode 100644
index d45c0bc..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/RunningJobsImpl.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.runtime.common.client;
-
-import com.microsoft.reef.annotations.audience.ClientSide;
-import com.microsoft.reef.annotations.audience.Private;
-import com.microsoft.reef.client.FailedRuntime;
-import com.microsoft.reef.client.parameters.ResourceManagerErrorHandler;
-import com.microsoft.reef.driver.parameters.DriverIdentifier;
-import com.microsoft.reef.proto.ReefServiceProtos;
-import com.microsoft.tang.InjectionFuture;
-import com.microsoft.tang.Injector;
-import com.microsoft.tang.annotations.Parameter;
-import com.microsoft.tang.exceptions.BindException;
-import com.microsoft.tang.exceptions.InjectionException;
-import com.microsoft.wake.EventHandler;
-import com.microsoft.wake.remote.RemoteMessage;
-
-import javax.inject.Inject;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-@ClientSide
-@Private
-final class RunningJobsImpl implements RunningJobs {
- private static final Logger LOG = Logger.getLogger(RunningJobsImpl.class.getName());
- private final Map<String, RunningJobImpl> jobs = new HashMap<>();
- private final Injector injector;
- private final InjectionFuture<EventHandler<FailedRuntime>> failedRuntimeEventHandler;
-
- @Inject
- RunningJobsImpl(final Injector injector,
- final @Parameter(ResourceManagerErrorHandler.class) InjectionFuture<EventHandler<FailedRuntime>> failedRuntimeEventHandler) {
- this.injector = injector;
- this.failedRuntimeEventHandler = failedRuntimeEventHandler;
- LOG.log(Level.FINE, "Instantiated 'RunningJobImpl'");
- }
-
-
- @Override
- public synchronized void closeAllJobs() {
- for (final RunningJobImpl runningJob : this.jobs.values()) {
- LOG.log(Level.WARNING, "Force close job {0}", runningJob.getId());
- runningJob.close();
- }
- }
-
- @Override
- public synchronized void onJobStatusMessage(final RemoteMessage<ReefServiceProtos.JobStatusProto> message) {
- final ReefServiceProtos.JobStatusProto status = message.getMessage();
- final String jobIdentifier = status.getIdentifier();
- LOG.log(Level.FINE, "Processing message from Job: " + jobIdentifier);
-
- if (status.getState() == ReefServiceProtos.State.INIT) {
- try {
- final RunningJobImpl runningJob = this.newRunningJob(status.getIdentifier(), message.getIdentifier().toString());
- this.put(runningJob);
- } catch (final BindException | InjectionException configError) {
- throw new RuntimeException("Configuration error for: " + status, configError);
- }
- }
-
- this.get(jobIdentifier).onNext(status);
- if ((status.getState() != ReefServiceProtos.State.RUNNING) &&
- (status.getState() != ReefServiceProtos.State.INIT)) {
- this.remove(status.getIdentifier());
- }
- LOG.log(Level.FINE, "Done processing message from Job " + jobIdentifier);
- }
-
- @Override
- public synchronized void onRuntimeErrorMessage(RemoteMessage<ReefServiceProtos.RuntimeErrorProto> runtimeFailure) {
- try {
- this.remove(runtimeFailure.getMessage().getIdentifier());
- } finally {
- this.failedRuntimeEventHandler.get().onNext(new FailedRuntime(runtimeFailure.getMessage()));
- }
- }
-
-
- /**
- * A guarded get() that throws an exception if the RunningJob isn't known
- *
- * @param jobIdentifier
- * @return
- */
- private synchronized RunningJobImpl get(final String jobIdentifier) {
- final RunningJobImpl result = this.jobs.get(jobIdentifier);
- if (null == result) {
- throw new RuntimeException("Trying to get a RunningJob that is unknown: " + jobIdentifier);
- }
- return result;
- }
-
- /**
- * A guarded remove() that throws an exception if no RunningJob is known for this id.
- *
- * @param jobIdentifier
- */
- private synchronized void remove(final String jobIdentifier) {
- final RunningJobImpl result = this.jobs.remove(jobIdentifier);
- if (null == result) {
- throw new RuntimeException("Trying to remove a RunningJob that is unknown: " + jobIdentifier);
- }
- }
-
-
- private synchronized void put(final RunningJobImpl runningJob) {
- final String jobIdentifier = runningJob.getId();
- if (this.jobs.containsKey(jobIdentifier)) {
- throw new IllegalStateException("Trying to re-add a job that is already known: " + jobIdentifier);
- }
- LOG.log(Level.FINE, "Adding Job with ID: " + jobIdentifier);
- this.jobs.put(jobIdentifier, runningJob);
- }
-
- /**
- * @param jobIdentifier
- * @param remoteIdentifier
- * @return
- * @throws BindException
- * @throws InjectionException
- */
- private synchronized RunningJobImpl newRunningJob(final String jobIdentifier, final String remoteIdentifier) throws BindException, InjectionException {
- final Injector child = this.injector.forkInjector();
- child.bindVolatileParameter(REEFImplementation.DriverRemoteIdentifier.class, remoteIdentifier);
- child.bindVolatileParameter(DriverIdentifier.class, jobIdentifier);
- return child.getInstance(RunningJobImpl.class);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/RuntimeErrorProtoHandler.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/RuntimeErrorProtoHandler.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/RuntimeErrorProtoHandler.java
deleted file mode 100644
index 6a3286f..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/RuntimeErrorProtoHandler.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.runtime.common.client;
-
-import com.microsoft.reef.proto.ReefServiceProtos;
-import com.microsoft.tang.InjectionFuture;
-import com.microsoft.wake.EventHandler;
-import com.microsoft.wake.remote.RemoteMessage;
-
-import javax.inject.Inject;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Used in REEFImplementation.
- */
-final class RuntimeErrorProtoHandler implements EventHandler<RemoteMessage<ReefServiceProtos.RuntimeErrorProto>> {
-
- private final static Logger LOG = Logger.getLogger(RuntimeErrorProtoHandler.class.getName());
-
- private final InjectionFuture<RunningJobs> runningJobs;
-
- @Inject
- RuntimeErrorProtoHandler(final InjectionFuture<RunningJobs> runningJobs) {
- this.runningJobs = runningJobs;
- }
-
-
- @Override
- public void onNext(final RemoteMessage<ReefServiceProtos.RuntimeErrorProto> error) {
- LOG.log(Level.WARNING, "{0} Runtime Error: {1}", new Object[]{
- error.getIdentifier(), error.getMessage().getMessage()});
- this.runningJobs.get().onRuntimeErrorMessage(error);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/api/ClientRuntimeParameters.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/api/ClientRuntimeParameters.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/api/ClientRuntimeParameters.java
deleted file mode 100644
index 8c88078..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/api/ClientRuntimeParameters.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.runtime.common.client.api;
-
-import com.microsoft.tang.annotations.Name;
-import com.microsoft.tang.annotations.NamedParameter;
-
-public final class ClientRuntimeParameters {
-
- @NamedParameter(doc = "The runtime error handler RID.")
- public final static class RuntimeErrorHandlerRID implements Name<String> { }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/api/JobSubmissionHandler.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/api/JobSubmissionHandler.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/api/JobSubmissionHandler.java
deleted file mode 100644
index 18b262d..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/api/JobSubmissionHandler.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.runtime.common.client.api;
-
-import com.microsoft.reef.annotations.audience.RuntimeAuthor;
-import com.microsoft.reef.proto.ClientRuntimeProtocol.JobSubmissionProto;
-import com.microsoft.wake.EventHandler;
-
-@RuntimeAuthor
-public interface JobSubmissionHandler extends EventHandler<JobSubmissionProto>, AutoCloseable {
-
- @Override
- public void close();
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/api/package-info.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/api/package-info.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/api/package-info.java
deleted file mode 100644
index b7c2ca7..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/api/package-info.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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.
- */
-/**
- * Client-Side Event Handlers to be implemented by a specific resourcemanager
- */
-package com.microsoft.reef.runtime.common.client.api;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/defaults/DefaultCompletedJobHandler.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/defaults/DefaultCompletedJobHandler.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/defaults/DefaultCompletedJobHandler.java
deleted file mode 100644
index adfdaf6..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/defaults/DefaultCompletedJobHandler.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.runtime.common.client.defaults;
-
-import com.microsoft.reef.annotations.Provided;
-import com.microsoft.reef.annotations.audience.ClientSide;
-import com.microsoft.reef.client.CompletedJob;
-import com.microsoft.wake.EventHandler;
-
-import javax.inject.Inject;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Default event handler for CompletedJob: Logging it.
- */
-@Provided
-@ClientSide
-public final class DefaultCompletedJobHandler implements EventHandler<CompletedJob> {
-
- private static final Logger LOG = Logger.getLogger(DefaultCompletedJobHandler.class.getName());
-
- @Inject
- private DefaultCompletedJobHandler() {
- }
-
- @Override
- public void onNext(final CompletedJob job) {
- LOG.log(Level.INFO, "Job Completed: {0}", job);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/defaults/DefaultFailedJobHandler.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/defaults/DefaultFailedJobHandler.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/defaults/DefaultFailedJobHandler.java
deleted file mode 100644
index b7c31d3..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/defaults/DefaultFailedJobHandler.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.runtime.common.client.defaults;
-
-import com.microsoft.reef.annotations.Provided;
-import com.microsoft.reef.annotations.audience.ClientSide;
-import com.microsoft.reef.client.FailedJob;
-import com.microsoft.wake.EventHandler;
-
-import javax.inject.Inject;
-
-/**
- * Default event handler for FailedJob: rethrow the exception.
- */
-@Provided
-@ClientSide
-public final class DefaultFailedJobHandler implements EventHandler<FailedJob> {
-
- @Inject
- private DefaultFailedJobHandler() {
- }
-
- @Override
- public void onNext(final FailedJob job) {
- throw new RuntimeException("REEF job failed: " + job.getId(), job.getReason().orElse(null));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/defaults/DefaultJobMessageHandler.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/defaults/DefaultJobMessageHandler.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/defaults/DefaultJobMessageHandler.java
deleted file mode 100644
index 1841aaa..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/defaults/DefaultJobMessageHandler.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.runtime.common.client.defaults;
-
-import com.microsoft.reef.annotations.Provided;
-import com.microsoft.reef.annotations.audience.ClientSide;
-import com.microsoft.reef.client.JobMessage;
-import com.microsoft.wake.EventHandler;
-
-import javax.inject.Inject;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-
-/**
- * Default event handler for job message: Logging it.
- */
-@Provided
-@ClientSide
-public final class DefaultJobMessageHandler implements EventHandler<JobMessage> {
-
- private static final Logger LOG = Logger.getLogger(DefaultJobMessageHandler.class.getName());
-
- @Inject
- private DefaultJobMessageHandler() {
- }
-
- @Override
- public void onNext(final JobMessage message) {
- LOG.log(Level.FINE, "Received message: {0}", message);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/defaults/DefaultRunningJobHandler.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/defaults/DefaultRunningJobHandler.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/defaults/DefaultRunningJobHandler.java
deleted file mode 100644
index d56619d..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/defaults/DefaultRunningJobHandler.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.runtime.common.client.defaults;
-
-import com.microsoft.reef.annotations.Provided;
-import com.microsoft.reef.annotations.audience.ClientSide;
-import com.microsoft.reef.client.RunningJob;
-import com.microsoft.wake.EventHandler;
-
-import javax.inject.Inject;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Default event handler for RunningJob: Logging it.
- */
-@Provided
-@ClientSide
-public final class DefaultRunningJobHandler implements EventHandler<RunningJob> {
-
- private static final Logger LOG = Logger.getLogger(DefaultRunningJobHandler.class.getName());
-
- @Inject
- private DefaultRunningJobHandler() {
- }
-
- @Override
- public void onNext(final RunningJob job) {
- LOG.log(Level.INFO, "Job is running: {0}", job);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/defaults/DefaultRuntimeErrorHandler.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/defaults/DefaultRuntimeErrorHandler.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/defaults/DefaultRuntimeErrorHandler.java
deleted file mode 100644
index e0af255..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/defaults/DefaultRuntimeErrorHandler.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.runtime.common.client.defaults;
-
-import com.microsoft.reef.annotations.Provided;
-import com.microsoft.reef.annotations.audience.ClientSide;
-import com.microsoft.reef.client.FailedRuntime;
-import com.microsoft.wake.EventHandler;
-
-import javax.inject.Inject;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Default event handler for REEF FailedRuntime: rethrow the exception.
- */
-@Provided
-@ClientSide
-public final class DefaultRuntimeErrorHandler implements EventHandler<FailedRuntime> {
-
- private static final Logger LOG = Logger.getLogger(DefaultRuntimeErrorHandler.class.getName());
-
- @Inject
- private DefaultRuntimeErrorHandler() {
- }
-
- @Override
- public void onNext(final FailedRuntime error) {
- if (error.getReason().isPresent()) {
- LOG.log(Level.SEVERE, "Runtime error: " + error, error.getReason().get());
- } else {
- LOG.log(Level.SEVERE, "Runtime error: " + error);
- }
- throw new RuntimeException("REEF runtime error: " + error, error.asError());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/defaults/package-info.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/defaults/package-info.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/defaults/package-info.java
deleted file mode 100644
index 7126c7c..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/defaults/package-info.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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.
- */
-/**
- * Default implementations for the optional client-side event handlers.
- */
-package com.microsoft.reef.runtime.common.client.defaults;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/package-info.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/package-info.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/package-info.java
deleted file mode 100644
index 76b1322..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/package-info.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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.
- */
-/**
- * Implementation of the client-side REEF API.
- */
-package com.microsoft.reef.runtime.common.client;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/parameters/ClientPresent.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/parameters/ClientPresent.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/parameters/ClientPresent.java
deleted file mode 100644
index 4b79190..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/client/parameters/ClientPresent.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.runtime.common.client.parameters;
-
-import com.microsoft.reef.annotations.audience.ClientSide;
-import com.microsoft.tang.annotations.Name;
-import com.microsoft.tang.annotations.NamedParameter;
-
-/**
- * A Tang named parameter that indicates whether or not a client (handler for the various Job events) is present.
- */
-@ClientSide
-@NamedParameter(doc = "Indicates whether or not a client is present", default_value = ClientPresent.NO)
-public final class ClientPresent implements Name<String> {
- public static final String YES = "YES";
- public static final String NO = "NO";
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/driver/DriverExceptionHandler.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/driver/DriverExceptionHandler.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/driver/DriverExceptionHandler.java
deleted file mode 100644
index b54c362..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/driver/DriverExceptionHandler.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.runtime.common.driver;
-
-import com.microsoft.reef.annotations.audience.DriverSide;
-import com.microsoft.reef.annotations.audience.Private;
-import com.microsoft.wake.EventHandler;
-
-import javax.inject.Inject;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Exception handler for exceptions thrown by client code in the Driver.
- * It uses the JobMessageObserverImpl to send an update to the client and die.
- */
-@Private
-@DriverSide
-public final class DriverExceptionHandler implements EventHandler<Throwable> {
- private static final Logger LOG = Logger.getLogger(DriverExceptionHandler.class.getName());
- /**
- * We delegate the failures to this object.
- */
- private final DriverStatusManager driverStatusManager;
-
- @Inject
- public DriverExceptionHandler(final DriverStatusManager driverStatusManager) {
- this.driverStatusManager = driverStatusManager;
- LOG.log(Level.FINE, "Instantiated 'DriverExceptionHandler'");
- }
-
-
- @Override
- public void onNext(final Throwable throwable) {
- this.driverStatusManager.onError(throwable);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/driver/DriverRuntimeConfiguration.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/driver/DriverRuntimeConfiguration.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/driver/DriverRuntimeConfiguration.java
deleted file mode 100644
index cb5b4c2..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/driver/DriverRuntimeConfiguration.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.runtime.common.driver;
-
-import com.microsoft.reef.annotations.audience.ClientSide;
-import com.microsoft.reef.annotations.audience.Private;
-import com.microsoft.reef.driver.catalog.ResourceCatalog;
-import com.microsoft.reef.driver.client.JobMessageObserver;
-import com.microsoft.reef.driver.evaluator.EvaluatorRequestor;
-import com.microsoft.reef.driver.parameters.DriverIdleSources;
-import com.microsoft.reef.runtime.common.driver.api.RuntimeParameters;
-import com.microsoft.reef.runtime.common.driver.catalog.ResourceCatalogImpl;
-import com.microsoft.reef.runtime.common.driver.client.ClientManager;
-import com.microsoft.reef.runtime.common.driver.client.JobMessageObserverImpl;
-import com.microsoft.reef.runtime.common.driver.idle.ClockIdlenessSource;
-import com.microsoft.reef.runtime.common.driver.idle.EventHandlerIdlenessSource;
-import com.microsoft.reef.runtime.common.driver.resourcemanager.NodeDescriptorHandler;
-import com.microsoft.reef.runtime.common.driver.resourcemanager.ResourceAllocationHandler;
-import com.microsoft.reef.runtime.common.driver.resourcemanager.ResourceManagerStatus;
-import com.microsoft.reef.runtime.common.driver.resourcemanager.ResourceStatusHandler;
-import com.microsoft.tang.formats.ConfigurationModule;
-import com.microsoft.tang.formats.ConfigurationModuleBuilder;
-import com.microsoft.wake.time.Clock;
-
-@Private
-@ClientSide
-public final class DriverRuntimeConfiguration extends ConfigurationModuleBuilder {
-
- public static final ConfigurationModule CONF = new DriverRuntimeConfiguration()
- // Resource Catalog
- .bindImplementation(ResourceCatalog.class, ResourceCatalogImpl.class)
-
- // JobMessageObserver
- .bindImplementation(EvaluatorRequestor.class, EvaluatorRequestorImpl.class) // requesting evaluators
- .bindImplementation(JobMessageObserver.class, JobMessageObserverImpl.class) // sending message to job client
-
- // Client manager
- .bindNamedParameter(DriverRuntimeConfigurationOptions.JobControlHandler.class, ClientManager.class)
-
- // Bind the resourcemanager parameters
- .bindNamedParameter(RuntimeParameters.NodeDescriptorHandler.class, NodeDescriptorHandler.class)
- .bindNamedParameter(RuntimeParameters.ResourceAllocationHandler.class, ResourceAllocationHandler.class)
- .bindNamedParameter(RuntimeParameters.ResourceStatusHandler.class, ResourceStatusHandler.class)
- .bindNamedParameter(RuntimeParameters.RuntimeStatusHandler.class, ResourceManagerStatus.class)
-
- // Bind to the Clock
- .bindSetEntry(Clock.RuntimeStartHandler.class, DriverRuntimeStartHandler.class)
- .bindSetEntry(Clock.RuntimeStopHandler.class, DriverRuntimeStopHandler.class)
-
- // Bind the idle handlers
- .bindSetEntry(DriverIdleSources.class, ClockIdlenessSource.class)
- .bindSetEntry(DriverIdleSources.class, EventHandlerIdlenessSource.class)
- .bindSetEntry(DriverIdleSources.class, ResourceManagerStatus.class)
- .bindSetEntry(Clock.IdleHandler.class, ClockIdlenessSource.class)
-
- .build();
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/driver/DriverRuntimeConfigurationOptions.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/driver/DriverRuntimeConfigurationOptions.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/driver/DriverRuntimeConfigurationOptions.java
deleted file mode 100644
index 038902a..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/driver/DriverRuntimeConfigurationOptions.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.runtime.common.driver;
-
-import com.microsoft.reef.proto.ClientRuntimeProtocol;
-import com.microsoft.tang.annotations.Name;
-import com.microsoft.tang.annotations.NamedParameter;
-import com.microsoft.wake.EventHandler;
-
-/**
- * Houses the Driver resourcemanager configuration's NamedParameters
- */
-public class DriverRuntimeConfigurationOptions {
- @NamedParameter(doc = "Called when a job control message is received by the client.")
- public final static class JobControlHandler implements Name<EventHandler<ClientRuntimeProtocol.JobControlProto>> {
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/driver/DriverRuntimeStartHandler.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/driver/DriverRuntimeStartHandler.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/driver/DriverRuntimeStartHandler.java
deleted file mode 100644
index 460367b..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/driver/DriverRuntimeStartHandler.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.runtime.common.driver;
-
-import com.microsoft.reef.proto.EvaluatorRuntimeProtocol;
-import com.microsoft.reef.proto.ReefServiceProtos;
-import com.microsoft.reef.runtime.common.driver.evaluator.EvaluatorHeartbeatHandler;
-import com.microsoft.reef.runtime.common.driver.evaluator.EvaluatorResourceManagerErrorHandler;
-import com.microsoft.reef.runtime.common.driver.resourcemanager.ResourceManagerStatus;
-import com.microsoft.reef.runtime.common.utils.RemoteManager;
-import com.microsoft.wake.EventHandler;
-import com.microsoft.wake.time.runtime.event.RuntimeStart;
-
-import javax.inject.Inject;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * The RuntimeStart handler of the Driver.
- * <p/>
- * This instantiates the DriverSingletons upon construction. Upon onNext(), it sets the resource manager status and
- * wires up the remote event handler connections to the client and the evaluators.
- */
-final class DriverRuntimeStartHandler implements EventHandler<RuntimeStart> {
- private static final Logger LOG = Logger.getLogger(DriverRuntimeStartHandler.class.getName());
- private final RemoteManager remoteManager;
- private final EvaluatorResourceManagerErrorHandler evaluatorResourceManagerErrorHandler;
- private final EvaluatorHeartbeatHandler evaluatorHeartbeatHandler;
- private final ResourceManagerStatus resourceManagerStatus;
- private final DriverStatusManager driverStatusManager;
-
- /**
- * @param singletons the objects we want to be Singletons in the Driver
- * @param remoteManager the remoteManager in the Driver.
- * @param evaluatorResourceManagerErrorHandler This will be wired up to the remoteManager on onNext()
- * @param evaluatorHeartbeatHandler This will be wired up to the remoteManager on onNext()
- * @param resourceManagerStatus will be set to RUNNING in onNext()
- * @param driverStatusManager will be set to RUNNING in onNext()
- */
- @Inject
- DriverRuntimeStartHandler(final DriverSingletons singletons,
- final RemoteManager remoteManager,
- final EvaluatorResourceManagerErrorHandler evaluatorResourceManagerErrorHandler,
- final EvaluatorHeartbeatHandler evaluatorHeartbeatHandler,
- final ResourceManagerStatus resourceManagerStatus,
- final DriverStatusManager driverStatusManager) {
- this.remoteManager = remoteManager;
- this.evaluatorResourceManagerErrorHandler = evaluatorResourceManagerErrorHandler;
- this.evaluatorHeartbeatHandler = evaluatorHeartbeatHandler;
- this.resourceManagerStatus = resourceManagerStatus;
- this.driverStatusManager = driverStatusManager;
- }
-
- @Override
- public synchronized void onNext(final RuntimeStart runtimeStart) {
- LOG.log(Level.FINEST, "RuntimeStart: {0}", runtimeStart);
-
- this.remoteManager.registerHandler(EvaluatorRuntimeProtocol.EvaluatorHeartbeatProto.class, evaluatorHeartbeatHandler);
- this.remoteManager.registerHandler(ReefServiceProtos.RuntimeErrorProto.class, evaluatorResourceManagerErrorHandler);
- this.resourceManagerStatus.setRunning();
- this.driverStatusManager.onRunning();
- LOG.log(Level.FINEST, "DriverRuntimeStartHandler complete.");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/driver/DriverRuntimeStopHandler.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/driver/DriverRuntimeStopHandler.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/driver/DriverRuntimeStopHandler.java
deleted file mode 100644
index a61fc25..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/driver/DriverRuntimeStopHandler.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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 com.microsoft.reef.runtime.common.driver;
-
-import com.microsoft.reef.annotations.audience.DriverSide;
-import com.microsoft.reef.annotations.audience.Private;
-import com.microsoft.reef.runtime.common.driver.evaluator.Evaluators;
-import com.microsoft.reef.runtime.common.utils.RemoteManager;
-import com.microsoft.reef.util.Optional;
-import com.microsoft.wake.EventHandler;
-import com.microsoft.wake.time.runtime.event.RuntimeStop;
-
-import javax.inject.Inject;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Handler for the RuntimeStop event in the Driver. It shuts down the evaluators and the RemoteManager and
- * informs the Client.
- */
-@Private
-@DriverSide
-final class DriverRuntimeStopHandler implements EventHandler<RuntimeStop> {
- private static final Logger LOG = Logger.getLogger(DriverRuntimeStopHandler.class.getName());
-
- private final DriverStatusManager driverStatusManager;
- private final RemoteManager remoteManager;
- private final Evaluators evaluators;
-
- @Inject
- DriverRuntimeStopHandler(final DriverStatusManager driverStatusManager,
- final RemoteManager remoteManager,
- final Evaluators evaluators) {
- this.driverStatusManager = driverStatusManager;
- this.remoteManager = remoteManager;
- this.evaluators = evaluators;
- }
-
- @Override
- public synchronized void onNext(final RuntimeStop runtimeStop) {
- LOG.log(Level.FINEST, "RuntimeStop: {0}", runtimeStop);
- // Shutdown the Evaluators.
- this.evaluators.close();
- // Inform the client of the shutdown.
- final Optional<Throwable> exception = Optional.<Throwable>ofNullable(runtimeStop.getException());
- this.driverStatusManager.sendJobEndingMessageToClient(exception);
- // Close the remoteManager.
- try {
- this.remoteManager.close();
- LOG.log(Level.INFO, "Driver shutdown complete");
- } catch (final Exception e) {
- throw new RuntimeException("Unable to close the RemoteManager.", e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/50444bba/reef-common/src/main/java/com/microsoft/reef/runtime/common/driver/DriverSingleton.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/com/microsoft/reef/runtime/common/driver/DriverSingleton.java b/reef-common/src/main/java/com/microsoft/reef/runtime/common/driver/DriverSingleton.java
deleted file mode 100644
index bc61578..0000000
--- a/reef-common/src/main/java/com/microsoft/reef/runtime/common/driver/DriverSingleton.java
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- * Copyright (C) 2014 Microsoft Corporation
- *
- * Licensed 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.
- */