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.unmanaged;
020
021import org.apache.hadoop.yarn.conf.YarnConfiguration;
022import org.apache.reef.annotations.audience.DriverSide;
023import org.apache.reef.annotations.audience.Public;
024import org.apache.reef.driver.parameters.DriverIsUnmanaged;
025import org.apache.reef.io.TempFileCreator;
026import org.apache.reef.io.WorkingDirectoryTempFileCreator;
027import org.apache.reef.runtime.common.UserCredentials;
028import org.apache.reef.runtime.common.driver.api.*;
029import org.apache.reef.runtime.common.driver.parameters.ClientRemoteIdentifier;
030import org.apache.reef.runtime.common.driver.parameters.DefinedRuntimes;
031import org.apache.reef.runtime.common.driver.parameters.EvaluatorTimeout;
032import org.apache.reef.runtime.common.driver.parameters.JobIdentifier;
033import org.apache.reef.runtime.common.files.RuntimeClasspathProvider;
034import org.apache.reef.runtime.common.launch.REEFErrorHandler;
035import org.apache.reef.runtime.common.launch.REEFMessageCodec;
036import org.apache.reef.runtime.common.launch.parameters.ErrorHandlerRID;
037import org.apache.reef.runtime.common.launch.parameters.LaunchID;
038import org.apache.reef.runtime.common.parameters.JVMHeapSlack;
039import org.apache.reef.runtime.yarn.YarnClasspathProvider;
040import org.apache.reef.runtime.yarn.driver.*;
041import org.apache.reef.runtime.yarn.driver.parameters.JobSubmissionDirectory;
042import org.apache.reef.runtime.yarn.driver.parameters.YarnHeartbeatPeriod;
043import org.apache.reef.runtime.yarn.util.YarnConfigurationConstructor;
044import org.apache.reef.tang.formats.*;
045import org.apache.reef.wake.remote.RemoteConfiguration;
046
047/**
048 * Build configuration for REEF driver running in unmanaged mode under the YARN resource manager.
049 */
050@Public
051@DriverSide
052public final class UnmanagedAmYarnDriverConfiguration extends ConfigurationModuleBuilder {
053
054  public static final RequiredParameter<String> JOB_IDENTIFIER = new RequiredParameter<>();
055  public static final RequiredParameter<String> JOB_SUBMISSION_DIRECTORY = new RequiredParameter<>();
056
057  public static final OptionalParameter<Integer> YARN_HEARTBEAT_INTERVAL = new OptionalParameter<>();
058  public static final OptionalImpl<RackNameFormatter> RACK_NAME_FORMATTER = new OptionalImpl<>();
059  public static final OptionalParameter<Long> EVALUATOR_TIMEOUT = new OptionalParameter<>();
060  public static final OptionalParameter<String> CLIENT_REMOTE_IDENTIFIER = new OptionalParameter<>();
061  public static final OptionalParameter<Double> JVM_HEAP_SLACK = new OptionalParameter<>();
062
063  public static final ConfigurationModule CONF =
064      new UnmanagedAmYarnDriverConfiguration()
065          .bindNamedParameter(LaunchID.class, JOB_IDENTIFIER)
066          .bindNamedParameter(JobIdentifier.class, JOB_IDENTIFIER)
067          .bindNamedParameter(JobSubmissionDirectory.class, JOB_SUBMISSION_DIRECTORY)
068          // REEF client parameters
069          .bindNamedParameter(RemoteConfiguration.ManagerName.class, "REEF_UNMANAGED_DRIVER")
070          .bindNamedParameter(RemoteConfiguration.ErrorHandler.class, REEFErrorHandler.class)
071          .bindNamedParameter(RemoteConfiguration.MessageCodec.class, REEFMessageCodec.class)
072          // YARN runtime
073          .bindNamedParameter(DriverIsUnmanaged.class, "true")
074          .bindImplementation(ResourceLaunchHandler.class, YARNResourceLaunchHandler.class)
075          .bindImplementation(ResourceReleaseHandler.class, YARNResourceReleaseHandler.class)
076          .bindImplementation(ResourceRequestHandler.class, YarnResourceRequestHandler.class)
077          .bindImplementation(ResourceManagerStartHandler.class, YARNRuntimeStartHandler.class)
078          .bindImplementation(ResourceManagerStopHandler.class, YARNRuntimeStopHandler.class)
079          .bindConstructor(YarnConfiguration.class, YarnConfigurationConstructor.class)
080          .bindImplementation(TempFileCreator.class, WorkingDirectoryTempFileCreator.class)
081          .bindNamedParameter(YarnHeartbeatPeriod.class, YARN_HEARTBEAT_INTERVAL)
082          // AbstractDriverRuntime parameters
083          .bindNamedParameter(EvaluatorTimeout.class, EVALUATOR_TIMEOUT)
084          .bindNamedParameter(ClientRemoteIdentifier.class, CLIENT_REMOTE_IDENTIFIER)
085          .bindNamedParameter(ErrorHandlerRID.class, CLIENT_REMOTE_IDENTIFIER)
086          .bindNamedParameter(JVMHeapSlack.class, JVM_HEAP_SLACK)
087          .bindImplementation(RackNameFormatter.class, RACK_NAME_FORMATTER)
088          .bindImplementation(RuntimeClasspathProvider.class, YarnClasspathProvider.class)
089          .bindImplementation(UserCredentials.class, YarnProxyUser.class)
090          .bindNamedParameter(DefinedRuntimes.class, RuntimeIdentifier.RUNTIME_NAME)
091          .build();
092
093  /** Cannot instantiate this utility class. */
094  private UnmanagedAmYarnDriverConfiguration() { }
095}