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.standalone.client; 020 021import org.apache.reef.runtime.local.LocalClasspathProvider; 022import org.apache.reef.runtime.local.client.LocalJobSubmissionHandler; 023import org.apache.reef.runtime.local.client.ExecutorServiceConstructor; 024import org.apache.reef.client.parameters.DriverConfigurationProviders; 025import org.apache.reef.runtime.common.client.CommonRuntimeConfiguration; 026import org.apache.reef.runtime.common.client.DriverConfigurationProvider; 027import org.apache.reef.runtime.common.client.api.JobSubmissionHandler; 028import org.apache.reef.runtime.common.files.RuntimeClasspathProvider; 029import org.apache.reef.runtime.standalone.client.parameters.NodeFolder; 030import org.apache.reef.runtime.standalone.client.parameters.NodeListFilePath; 031import org.apache.reef.runtime.standalone.client.parameters.RootFolder; 032import org.apache.reef.runtime.standalone.client.parameters.SshPortNum; 033import org.apache.reef.tang.ConfigurationProvider; 034import org.apache.reef.tang.formats.*; 035 036import java.util.concurrent.ExecutorService; 037 038/** 039 * A ConfigurationModule to configure the standalone resourcemanager. 040 */ 041public final class StandaloneRuntimeConfiguration extends ConfigurationModuleBuilder { 042 043 /** 044 * The file containing a list of remote ssh nodes (i.e. `username@147.0.23.14`), separated by newlines. 045 * The standalone runtime assumes the Driver to run on the same node as Client, thus a local file path is expected. 046 * Currently, we expect that $JAVA_HOME is specified to the same directory in each of the nodes. 047 */ 048 public static final RequiredParameter<String> NODE_LIST_FILE_PATH = new RequiredParameter<>(); 049 /** 050 * Folder to save the shaded jar for the remote nodes. 051 */ 052 public static final OptionalParameter<String> NODE_FOLDER = new OptionalParameter<>(); 053 054 /** 055 * Folder to save the files generated by REEF. The corresponding sub-folders will be created for each node. 056 */ 057 public static final OptionalParameter<String> RUNTIME_ROOT_FOLDER = new OptionalParameter<>(); 058 059 /** 060 * The port number to attempt the ssh connection. 061 */ 062 public static final OptionalParameter<Integer> SSH_PORT_NUM = new OptionalParameter<>(); 063 064 /** 065 * Configuration provides whose Configuration will be merged into all Driver Configuration. 066 */ 067 public static final OptionalImpl<ConfigurationProvider> DRIVER_CONFIGURATION_PROVIDERS = new OptionalImpl<>(); 068 069 /** 070 * The ConfigurationModule for the standalone resourcemanager. 071 */ 072 public static final ConfigurationModule CONF = new StandaloneRuntimeConfiguration() 073 .merge(CommonRuntimeConfiguration.CONF) 074 // Bind the standalone runtime 075 .bindImplementation(JobSubmissionHandler.class, LocalJobSubmissionHandler.class) 076 .bindImplementation(DriverConfigurationProvider.class, StandaloneDriverConfigurationProviderImpl.class) 077 .bindConstructor(ExecutorService.class, ExecutorServiceConstructor.class) 078 .bindImplementation(RuntimeClasspathProvider.class, LocalClasspathProvider.class) 079 // Bind parameters of the standalone runtime 080 .bindNamedParameter(NodeListFilePath.class, NODE_LIST_FILE_PATH) 081 .bindNamedParameter(NodeFolder.class, NODE_FOLDER) 082 .bindNamedParameter(RootFolder.class, RUNTIME_ROOT_FOLDER) 083 .bindNamedParameter(SshPortNum.class, SSH_PORT_NUM) 084 .bindSetEntry(DriverConfigurationProviders.class, DRIVER_CONFIGURATION_PROVIDERS) 085 .build(); 086 087 088}