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.runtime.yarn.driver;
020
021import org.apache.hadoop.yarn.conf.YarnConfiguration;
022import org.apache.reef.io.TempFileCreator;
023import org.apache.reef.io.WorkingDirectoryTempFileCreator;
024import org.apache.reef.runtime.common.driver.api.AbstractDriverRuntimeConfiguration;
025import org.apache.reef.runtime.common.driver.api.ResourceLaunchHandler;
026import org.apache.reef.runtime.common.driver.api.ResourceReleaseHandler;
027import org.apache.reef.runtime.common.driver.api.ResourceRequestHandler;
028import org.apache.reef.runtime.common.files.RuntimeClasspathProvider;
029import org.apache.reef.runtime.common.parameters.JVMHeapSlack;
030import org.apache.reef.runtime.yarn.YarnClasspathProvider;
031import org.apache.reef.runtime.yarn.driver.parameters.JobSubmissionDirectory;
032import org.apache.reef.runtime.yarn.driver.parameters.YarnHeartbeatPeriod;
033import org.apache.reef.runtime.yarn.util.YarnConfigurationConstructor;
034import org.apache.reef.tang.formats.ConfigurationModule;
035import org.apache.reef.tang.formats.ConfigurationModuleBuilder;
036import org.apache.reef.tang.formats.OptionalParameter;
037import org.apache.reef.tang.formats.RequiredParameter;
038import org.apache.reef.wake.time.Clock;
039
040/**
041 * Created by marku_000 on 2014-07-07.
042 */
043public class YarnDriverConfiguration extends ConfigurationModuleBuilder {
044  /**
045   * @see org.apache.reef.runtime.yarn.driver.parameters.JobSubmissionDirectory
046   */
047  public static final RequiredParameter<String> JOB_SUBMISSION_DIRECTORY = new RequiredParameter<>();
048  /**
049   * @see org.apache.reef.runtime.yarn.driver.parameters.YarnHeartbeatPeriod.class
050   */
051  public static final OptionalParameter<Integer> YARN_HEARTBEAT_INTERVAL = new OptionalParameter<>();
052
053  /**
054   * @see AbstractDriverRuntimeConfiguration.JobIdentifier.class
055   */
056  public static final RequiredParameter<String> JOB_IDENTIFIER = new RequiredParameter<>();
057
058  /**
059   * @see AbstractDriverRuntimeConfiguration.EvaluatorTimeout
060   */
061  public static final OptionalParameter<Long> EVALUATOR_TIMEOUT = new OptionalParameter<>();
062
063  /**
064   * The client remote identifier.
065   */
066  public static final OptionalParameter<String> CLIENT_REMOTE_IDENTIFIER = new OptionalParameter<>();
067
068  /**
069   * The fraction of the container memory NOT to use for the Java Heap.
070   */
071  public static final OptionalParameter<Double> JVM_HEAP_SLACK = new OptionalParameter<>();
072
073
074  public static ConfigurationModule CONF = new YarnDriverConfiguration()
075      // Bind the YARN runtime for the resource manager.
076      .bindImplementation(ResourceLaunchHandler.class, YARNResourceLaunchHandler.class)
077      .bindImplementation(ResourceReleaseHandler.class, YARNResourceReleaseHandler.class)
078      .bindImplementation(ResourceRequestHandler.class, YarnResourceRequestHandler.class)
079      .bindConstructor(YarnConfiguration.class, YarnConfigurationConstructor.class)
080      .bindSetEntry(Clock.RuntimeStartHandler.class, YARNRuntimeStartHandler.class)
081      .bindSetEntry(Clock.RuntimeStopHandler.class, YARNRuntimeStopHandler.class)
082      .bindImplementation(TempFileCreator.class, WorkingDirectoryTempFileCreator.class)
083
084          // Bind the YARN Configuration parameters
085      .bindNamedParameter(JobSubmissionDirectory.class, JOB_SUBMISSION_DIRECTORY)
086      .bindNamedParameter(YarnHeartbeatPeriod.class, YARN_HEARTBEAT_INTERVAL)
087
088          // Bind the fields bound in AbstractDriverRuntimeConfiguration
089      .bindNamedParameter(AbstractDriverRuntimeConfiguration.JobIdentifier.class, JOB_IDENTIFIER)
090      .bindNamedParameter(AbstractDriverRuntimeConfiguration.EvaluatorTimeout.class, EVALUATOR_TIMEOUT)
091      .bindNamedParameter(AbstractDriverRuntimeConfiguration.ClientRemoteIdentifier.class, CLIENT_REMOTE_IDENTIFIER)
092      .bindNamedParameter(JVMHeapSlack.class, JVM_HEAP_SLACK)
093      .bindImplementation(RuntimeClasspathProvider.class, YarnClasspathProvider.class)
094      .build();
095}