Repository: incubator-reef Updated Branches: refs/heads/master d81109959 -> aab0e6eb5
[REEF-433]: Rename `HelloReefYarn` to `HelloREEFYarn` JIRA: [REEF-433](https://issues.apache.org/jira/browse/REEF-433) Pull Request: This closes #260 Project: http://git-wip-us.apache.org/repos/asf/incubator-reef/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-reef/commit/aab0e6eb Tree: http://git-wip-us.apache.org/repos/asf/incubator-reef/tree/aab0e6eb Diff: http://git-wip-us.apache.org/repos/asf/incubator-reef/diff/aab0e6eb Branch: refs/heads/master Commit: aab0e6eb57b83378bbbaab7688e1abd9eb108688 Parents: d811099 Author: Jason (Joo Seong) Jeong <[email protected]> Authored: Tue Jun 30 18:35:52 2015 +0900 Committer: Markus Weimer <[email protected]> Committed: Tue Jun 30 10:48:52 2015 -0700 ---------------------------------------------------------------------- .../reef/examples/hello/HelloREEFYarn.java | 76 ++++++++++++++++++++ .../reef/examples/hello/HelloReefYarn.java | 76 -------------------- 2 files changed, 76 insertions(+), 76 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/aab0e6eb/lang/java/reef-examples/src/main/java/org/apache/reef/examples/hello/HelloREEFYarn.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-examples/src/main/java/org/apache/reef/examples/hello/HelloREEFYarn.java b/lang/java/reef-examples/src/main/java/org/apache/reef/examples/hello/HelloREEFYarn.java new file mode 100644 index 0000000..ad8d3f0 --- /dev/null +++ b/lang/java/reef-examples/src/main/java/org/apache/reef/examples/hello/HelloREEFYarn.java @@ -0,0 +1,76 @@ +/* + * 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.examples.hello; + +import org.apache.reef.client.DriverConfiguration; +import org.apache.reef.client.DriverLauncher; +import org.apache.reef.client.LauncherStatus; +import org.apache.reef.runtime.yarn.client.YarnClientConfiguration; +import org.apache.reef.tang.Configuration; +import org.apache.reef.tang.exceptions.InjectionException; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * The Client for running HelloREEF on YARN. + */ +public final class HelloREEFYarn { + + private static final Logger LOG = Logger.getLogger(HelloREEFYarn.class.getName()); + + /** + * Number of milliseconds to wait for the job to complete. + */ + private static final int JOB_TIMEOUT = 30000; // 30 sec. + + + /** + * @return the configuration of the HelloREEF driver. + */ + private static Configuration getDriverConfiguration() { + return DriverConfiguration.CONF + .set(DriverConfiguration.GLOBAL_LIBRARIES, HelloREEFYarn.class.getProtectionDomain().getCodeSource().getLocation().getFile()) + .set(DriverConfiguration.DRIVER_IDENTIFIER, "HelloREEF") + .set(DriverConfiguration.ON_DRIVER_STARTED, HelloDriver.StartHandler.class) + .set(DriverConfiguration.ON_EVALUATOR_ALLOCATED, HelloDriver.EvaluatorAllocatedHandler.class) + .build(); + } + + /** + * Start Hello REEF job. Runs method runHelloReef(). + * + * @param args command line parameters. + * @throws org.apache.reef.tang.exceptions.BindException configuration error. + * @throws org.apache.reef.tang.exceptions.InjectionException configuration error. + */ + public static void main(final String[] args) throws InjectionException { + + final LauncherStatus status = DriverLauncher + .getLauncher(YarnClientConfiguration.CONF.build()) + .run(getDriverConfiguration(), JOB_TIMEOUT); + LOG.log(Level.INFO, "REEF job completed: {0}", status); + } + + /** + * Empty private constructor to prohibit instantiation of utility class. + */ + private HelloREEFYarn() { + } +} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/aab0e6eb/lang/java/reef-examples/src/main/java/org/apache/reef/examples/hello/HelloReefYarn.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-examples/src/main/java/org/apache/reef/examples/hello/HelloReefYarn.java b/lang/java/reef-examples/src/main/java/org/apache/reef/examples/hello/HelloReefYarn.java deleted file mode 100644 index e3ef7bf..0000000 --- a/lang/java/reef-examples/src/main/java/org/apache/reef/examples/hello/HelloReefYarn.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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.examples.hello; - -import org.apache.reef.client.DriverConfiguration; -import org.apache.reef.client.DriverLauncher; -import org.apache.reef.client.LauncherStatus; -import org.apache.reef.runtime.yarn.client.YarnClientConfiguration; -import org.apache.reef.tang.Configuration; -import org.apache.reef.tang.exceptions.InjectionException; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * The Client for Hello REEF example. - */ -public final class HelloReefYarn { - - private static final Logger LOG = Logger.getLogger(HelloReefYarn.class.getName()); - - /** - * Number of milliseconds to wait for the job to complete. - */ - private static final int JOB_TIMEOUT = 30000; // 30 sec. - - - /** - * @return the configuration of the HelloREEF driver. - */ - private static Configuration getDriverConfiguration() { - return DriverConfiguration.CONF - .set(DriverConfiguration.GLOBAL_LIBRARIES, HelloReefYarn.class.getProtectionDomain().getCodeSource().getLocation().getFile()) - .set(DriverConfiguration.DRIVER_IDENTIFIER, "HelloREEF") - .set(DriverConfiguration.ON_DRIVER_STARTED, HelloDriver.StartHandler.class) - .set(DriverConfiguration.ON_EVALUATOR_ALLOCATED, HelloDriver.EvaluatorAllocatedHandler.class) - .build(); - } - - /** - * Start Hello REEF job. Runs method runHelloReef(). - * - * @param args command line parameters. - * @throws org.apache.reef.tang.exceptions.BindException configuration error. - * @throws org.apache.reef.tang.exceptions.InjectionException configuration error. - */ - public static void main(final String[] args) throws InjectionException { - - final LauncherStatus status = DriverLauncher - .getLauncher(YarnClientConfiguration.CONF.build()) - .run(getDriverConfiguration(), JOB_TIMEOUT); - LOG.log(Level.INFO, "REEF job completed: {0}", status); - } - - /** - * Empty private constructor to prohibit instantiation of utility class. - */ - private HelloReefYarn() { - } -}
