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.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.local.LocalClasspathProvider;
028import org.apache.reef.runtime.local.client.parameters.MaxNumberOfEvaluators;
029import org.apache.reef.runtime.local.client.parameters.RackNames;
030import org.apache.reef.runtime.local.client.parameters.RootFolder;
031import org.apache.reef.tang.ConfigurationProvider;
032import org.apache.reef.tang.formats.*;
033
034import java.util.concurrent.ExecutorService;
035
036/**
037 * A ConfigurationModule to configure the local resourcemanager with extensibility point.
038 */
039public final class ExtensibleLocalRuntimeConfiguration extends ConfigurationModuleBuilder {
040
041  /**
042   * The number of threads or processes available to the resourcemanager. This is the upper limit on the number of
043   * Evaluators that the local resourcemanager will hand out concurrently.
044   * This simulates the size of a physical cluster in terms of the number of slots available on it
045   * with one important caveat: The Driver is not counted against this number.
046   */
047  public static final OptionalParameter<Integer> MAX_NUMBER_OF_EVALUATORS = new OptionalParameter<>();
048  /**
049   * The folder in which the sub-folders, one per Node, will be created. Those will contain one folder per
050   * Evaluator instantiated on the virtual node. Those inner folders will be named by the time when the Evaluator was
051   * launched.
052   * <p>
053   * If none is given, a folder "REEF_LOCAL_RUNTIME" will be created in the local directory.
054   */
055  public static final OptionalParameter<String> RUNTIME_ROOT_FOLDER = new OptionalParameter<>();
056
057  /**
058   * The fraction of the container memory NOT to use for the Java Heap.
059   */
060  public static final OptionalParameter<Double> JVM_HEAP_SLACK = new OptionalParameter<>();
061
062  /**
063   * Configuration provides whose Configuration will be merged into all Driver Configuration.
064   */
065  public static final OptionalImpl<ConfigurationProvider> DRIVER_CONFIGURATION_PROVIDERS = new OptionalImpl<>();
066
067  /**
068   * The rack names that will be available in the local runtime.
069   */
070  public static final OptionalParameter<String> RACK_NAMES = new OptionalParameter<>();
071
072  /**
073   * Driver configuration provider for the client.
074   */
075  public static final RequiredImpl<DriverConfigurationProvider> DRIVER_CONFIGURATION_PROVIDER = new RequiredImpl<>();
076
077  /**
078   * The ConfigurationModule for the local resourcemanager.
079   */
080  public static final ConfigurationModule CONF = new ExtensibleLocalRuntimeConfiguration()
081          .merge(CommonRuntimeConfiguration.CONF)
082          // Bind the local runtime
083          .bindImplementation(JobSubmissionHandler.class, LocalJobSubmissionHandler.class)
084          .bindImplementation(DriverConfigurationProvider.class, DRIVER_CONFIGURATION_PROVIDER)
085          .bindConstructor(ExecutorService.class, ExecutorServiceConstructor.class)
086          .bindImplementation(RuntimeClasspathProvider.class, LocalClasspathProvider.class)
087          // Bind parameters of the local runtime
088          .bindNamedParameter(MaxNumberOfEvaluators.class, MAX_NUMBER_OF_EVALUATORS)
089          .bindNamedParameter(RootFolder.class, RUNTIME_ROOT_FOLDER)
090          .bindNamedParameter(JVMHeapSlack.class, JVM_HEAP_SLACK)
091          .bindSetEntry(DriverConfigurationProviders.class, DRIVER_CONFIGURATION_PROVIDERS)
092          .bindSetEntry(RackNames.class, RACK_NAMES)
093          .build();
094}
095