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.local.driver;
020
021import org.apache.reef.runtime.common.driver.api.*;
022import org.apache.reef.runtime.common.driver.parameters.ClientRemoteIdentifier;
023import org.apache.reef.runtime.common.driver.parameters.DefinedRuntimes;
024import org.apache.reef.runtime.common.driver.parameters.JobIdentifier;
025import org.apache.reef.runtime.common.files.RuntimeClasspathProvider;
026import org.apache.reef.runtime.common.launch.parameters.ErrorHandlerRID;
027import org.apache.reef.runtime.common.launch.parameters.LaunchID;
028import org.apache.reef.runtime.common.parameters.JVMHeapSlack;
029import org.apache.reef.runtime.local.LocalClasspathProvider;
030import org.apache.reef.runtime.local.client.parameters.MaxNumberOfEvaluators;
031import org.apache.reef.runtime.local.client.parameters.RackNames;
032import org.apache.reef.runtime.local.client.parameters.RootFolder;
033import org.apache.reef.tang.formats.ConfigurationModule;
034import org.apache.reef.tang.formats.ConfigurationModuleBuilder;
035import org.apache.reef.tang.formats.OptionalParameter;
036import org.apache.reef.tang.formats.RequiredParameter;
037
038/**
039 * ConfigurationModule for the Driver executed in the local resourcemanager. This is meant to eventually replace
040 * LocalDriverRuntimeConfiguration.
041 */
042public class LocalDriverConfiguration extends ConfigurationModuleBuilder {
043  /**
044   * The maximum number of evaluators.
045   */
046  public static final RequiredParameter<Integer> MAX_NUMBER_OF_EVALUATORS = new RequiredParameter<>();
047  /**
048   * The root folder of the job. Assumed to be an absolute path.
049   */
050  public static final RequiredParameter<String> ROOT_FOLDER = new RequiredParameter<>();
051  /**
052   * The name of the runitme.
053   */
054  public static final RequiredParameter<String> RUNTIME_NAMES = new RequiredParameter<>();
055  /**
056   * The fraction of the container memory NOT to use for the Java Heap.
057   */
058  public static final OptionalParameter<Double> JVM_HEAP_SLACK = new OptionalParameter<>();
059
060  /**
061  * The rack names that will be available in the local runtime.
062  */
063  public static final OptionalParameter<String> RACK_NAMES = new OptionalParameter<>();
064
065  /**
066   * The remote identifier to use for communications back to the client.
067   */
068  public static final OptionalParameter<String> CLIENT_REMOTE_IDENTIFIER = new OptionalParameter<>();
069
070  /**
071   * The identifier of the Job submitted.
072   */
073  public static final RequiredParameter<String> JOB_IDENTIFIER = new RequiredParameter<>();
074
075  public static final ConfigurationModule CONF = new LocalDriverConfiguration()
076      .bindImplementation(ResourceLaunchHandler.class, LocalResourceLaunchHandler.class)
077      .bindImplementation(ResourceRequestHandler.class, LocalResourceRequestHandler.class)
078      .bindImplementation(ResourceReleaseHandler.class, LocalResourceReleaseHandler.class)
079      .bindImplementation(ResourceManagerStartHandler.class, LocalResourceManagerStartHandler.class)
080      .bindImplementation(ResourceManagerStopHandler.class, LocalResourceManagerStopHandler.class)
081      .bindNamedParameter(ClientRemoteIdentifier.class, CLIENT_REMOTE_IDENTIFIER)
082      .bindNamedParameter(ErrorHandlerRID.class, CLIENT_REMOTE_IDENTIFIER)
083      .bindNamedParameter(JobIdentifier.class, JOB_IDENTIFIER)
084      .bindNamedParameter(LaunchID.class, JOB_IDENTIFIER)
085      .bindNamedParameter(MaxNumberOfEvaluators.class, MAX_NUMBER_OF_EVALUATORS)
086      .bindNamedParameter(RootFolder.class, ROOT_FOLDER)
087      .bindNamedParameter(JVMHeapSlack.class, JVM_HEAP_SLACK)
088      .bindSetEntry(RackNames.class, RACK_NAMES)
089      .bindImplementation(RuntimeClasspathProvider.class, LocalClasspathProvider.class)
090      .bindSetEntry(DefinedRuntimes.class, RUNTIME_NAMES)
091      .build();
092}