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.files.RuntimeClasspathProvider; 022import org.apache.reef.runtime.common.parameters.JVMHeapSlack; 023import org.apache.reef.runtime.local.LocalClasspathProvider; 024import org.apache.reef.runtime.local.client.parameters.NumberOfProcesses; 025import org.apache.reef.runtime.local.client.parameters.RootFolder; 026import org.apache.reef.runtime.local.driver.parameters.GlobalFiles; 027import org.apache.reef.runtime.local.driver.parameters.GlobalLibraries; 028import org.apache.reef.runtime.local.driver.parameters.LocalFiles; 029import org.apache.reef.runtime.local.driver.parameters.LocalLibraries; 030import org.apache.reef.tang.formats.ConfigurationModule; 031import org.apache.reef.tang.formats.ConfigurationModuleBuilder; 032import org.apache.reef.tang.formats.OptionalParameter; 033import org.apache.reef.tang.formats.RequiredParameter; 034 035/** 036 * ConfigurationModule for the Driver executed in the local resourcemanager. This is meant to eventually replace 037 * LocalDriverRuntimeConfiguration. 038 */ 039public class LocalDriverConfiguration extends ConfigurationModuleBuilder { 040 041 /** 042 * Files for the driver only. 043 */ 044 public static final OptionalParameter<String> LOCAL_FILES = new OptionalParameter<>(); 045 /** 046 * Libraries for the driver only. 047 */ 048 public static final OptionalParameter<String> LOCAL_LIBRARIES = new OptionalParameter<>(); 049 /** 050 * Files for the driver and all evaluators. 051 */ 052 public static final OptionalParameter<String> GLOBAL_FILES = new OptionalParameter<>(); 053 /** 054 * Libraries for the driver and all evaluators. 055 */ 056 public static final OptionalParameter<String> GLOBAL_LIBRARIES = new OptionalParameter<>(); 057 /** 058 * The maximum number or processes to spawn. 059 */ 060 public static final RequiredParameter<Integer> NUMBER_OF_PROCESSES = new RequiredParameter<>(); 061 /** 062 * The root folder of the job. Assumed to be an absolute path. 063 */ 064 public static final RequiredParameter<String> ROOT_FOLDER = new RequiredParameter<>(); 065 /** 066 * The fraction of the container memory NOT to use for the Java Heap. 067 */ 068 public static final OptionalParameter<Double> JVM_HEAP_SLACK = new OptionalParameter<>(); 069 070 071 public static final ConfigurationModule CONF = new LocalDriverConfiguration() 072 .bindSetEntry(LocalFiles.class, LOCAL_FILES) 073 .bindSetEntry(LocalLibraries.class, LOCAL_LIBRARIES) 074 .bindSetEntry(GlobalFiles.class, GLOBAL_FILES) 075 .bindSetEntry(GlobalLibraries.class, GLOBAL_LIBRARIES) 076 .bindNamedParameter(NumberOfProcesses.class, NUMBER_OF_PROCESSES) 077 .bindNamedParameter(RootFolder.class, ROOT_FOLDER) 078 .bindNamedParameter(JVMHeapSlack.class, JVM_HEAP_SLACK) 079 .bindImplementation(RuntimeClasspathProvider.class, LocalClasspathProvider.class) 080 .build(); 081}