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.client;
020
021import org.apache.reef.client.parameters.DriverConfigurationProviders;
022import org.apache.reef.runtime.common.client.CommonRuntimeConfiguration;
023import org.apache.reef.runtime.common.client.DriverConfigurationProvider;
024import org.apache.reef.runtime.common.client.api.JobSubmissionHandler;
025import org.apache.reef.runtime.common.files.RuntimeClasspathProvider;
026import org.apache.reef.runtime.common.parameters.JVMHeapSlack;
027import org.apache.reef.runtime.yarn.YarnClasspathProvider;
028import org.apache.reef.runtime.yarn.client.parameters.JobPriority;
029import org.apache.reef.runtime.yarn.client.parameters.JobQueue;
030import org.apache.reef.runtime.yarn.util.YarnConfigurationConstructor;
031import org.apache.reef.tang.ConfigurationProvider;
032import org.apache.reef.tang.formats.*;
033import org.apache.reef.util.logging.LoggingSetup;
034
035/**
036 * An extensible  ConfigurationModule for the YARN resourcemanager.
037 */
038public final class ExtensibleYarnClientConfiguration extends ConfigurationModuleBuilder {
039  static {
040    LoggingSetup.setupCommonsLogging();
041  }
042
043  public static final OptionalParameter<String> YARN_QUEUE_NAME = new OptionalParameter<>();
044  public static final OptionalParameter<Integer> YARN_PRIORITY = new OptionalParameter<>();
045
046  public static final OptionalParameter<Double> JVM_HEAP_SLACK = new OptionalParameter<>();
047
048  /**
049   * Configuration provides whose Configuration will be merged into all Driver Configuration.
050   */
051  public static final OptionalImpl<ConfigurationProvider> DRIVER_CONFIGURATION_PROVIDERS = new OptionalImpl<>();
052
053  /**
054   * Driver configuration provider for the client.
055   */
056  public static final RequiredImpl<DriverConfigurationProvider> DRIVER_CONFIGURATION_PROVIDER = new RequiredImpl<>();
057
058  public static final ConfigurationModule CONF = new ExtensibleYarnClientConfiguration()
059            .merge(CommonRuntimeConfiguration.CONF)
060            // Bind YARN
061            .bindImplementation(JobSubmissionHandler.class, YarnJobSubmissionHandler.class)
062            .bindImplementation(DriverConfigurationProvider.class, DRIVER_CONFIGURATION_PROVIDER)
063            // Bind the parameters given by the user
064            .bindNamedParameter(JobQueue.class, YARN_QUEUE_NAME)
065            .bindNamedParameter(JobPriority.class, YARN_PRIORITY)
066            .bindNamedParameter(JVMHeapSlack.class, JVM_HEAP_SLACK)
067            .bindImplementation(RuntimeClasspathProvider.class, YarnClasspathProvider.class)
068            // Bind external constructors. Taken from  YarnExternalConstructors.registerClientConstructors
069            .bindConstructor(org.apache.hadoop.yarn.conf.YarnConfiguration.class, YarnConfigurationConstructor.class)
070            .bindSetEntry(DriverConfigurationProviders.class, DRIVER_CONFIGURATION_PROVIDERS).build();
071}