This project has retired. For details please refer to its Attic page.
Source code
001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.apache.reef.examples.reefonreef;
020
021import org.apache.reef.client.DriverConfiguration;
022import org.apache.reef.client.DriverLauncher;
023import org.apache.reef.client.LauncherStatus;
024import org.apache.reef.runtime.yarn.client.YarnClientConfiguration;
025import org.apache.reef.tang.Configuration;
026import org.apache.reef.tang.exceptions.InjectionException;
027import org.apache.reef.util.EnvironmentUtils;
028
029import java.util.logging.Level;
030import java.util.logging.Logger;
031
032/** The Client for running REEF-on-REEF application on YARN. */
033public final class Launch {
034
035  private static final Logger LOG = Logger.getLogger(Launch.class.getName());
036
037  /**
038   * Number of milliseconds to wait for the job to complete.
039   * Setting to 100 sec because running on RM HA clusters take around
040   * 50 seconds to set the job to running.
041   */
042  private static final int JOB_TIMEOUT = 100000; // 100 sec.
043
044  private static final Configuration RUNTIME_CONFIG = YarnClientConfiguration.CONF.build();
045
046  private static final Configuration DRIVER_CONFIG = DriverConfiguration.CONF
047      .set(DriverConfiguration.GLOBAL_LIBRARIES, EnvironmentUtils.getClassLocation(ReefOnReefDriver.class))
048      .set(DriverConfiguration.DRIVER_IDENTIFIER, "REEF-on-REEF:host")
049      .set(DriverConfiguration.ON_DRIVER_STARTED, ReefOnReefDriver.class)
050      .build();
051
052  /**
053   * Start REEF-on-REEF job on YARN.
054   * @param args command line parameters (not used).
055   * @throws InjectionException configuration error.
056   */
057  public static void main(final String[] args) throws InjectionException {
058    final LauncherStatus status = DriverLauncher.getLauncher(RUNTIME_CONFIG).run(DRIVER_CONFIG, JOB_TIMEOUT);
059    LOG.log(Level.INFO, "REEF-on-REEF host job completed: {0}", status);
060  }
061
062  /** Empty private constructor to prohibit instantiation of utility class. */
063  private Launch() { }
064}