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.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.JobIdentifier; 024import org.apache.reef.runtime.common.files.RuntimeClasspathProvider; 025import org.apache.reef.runtime.common.launch.parameters.ErrorHandlerRID; 026import org.apache.reef.runtime.common.launch.parameters.LaunchID; 027import org.apache.reef.runtime.common.parameters.JVMHeapSlack; 028import org.apache.reef.runtime.local.LocalClasspathProvider; 029import org.apache.reef.runtime.standalone.client.parameters.RootFolder; 030import org.apache.reef.runtime.standalone.client.parameters.NodeFolder; 031import org.apache.reef.runtime.standalone.client.parameters.NodeListFilePath; 032import org.apache.reef.runtime.standalone.client.parameters.NodeInfoSet; 033import org.apache.reef.runtime.standalone.client.parameters.SshPortNum; 034import org.apache.reef.tang.formats.ConfigurationModule; 035import org.apache.reef.tang.formats.ConfigurationModuleBuilder; 036import org.apache.reef.tang.formats.OptionalParameter; 037import org.apache.reef.tang.formats.RequiredParameter; 038 039/** 040 * ConfigurationModule for the Driver executed in the standalone resourcemanager. This is meant to eventually replace 041 * StandaloneDriverRuntimeConfiguration. 042 */ 043public class StandaloneDriverConfiguration extends ConfigurationModuleBuilder { 044 /** 045 * The root folder of the job. Assumed to be an absolute path. 046 */ 047 public static final RequiredParameter<String> ROOT_FOLDER = new RequiredParameter<>(); 048 /** 049 * The fraction of the container memory NOT to use for the Java Heap. 050 */ 051 public static final OptionalParameter<Double> JVM_HEAP_SLACK = new OptionalParameter<>(); 052 053 /** 054 * The remote identifier to use for communications back to the client. 055 */ 056 public static final OptionalParameter<String> CLIENT_REMOTE_IDENTIFIER = new OptionalParameter<>(); 057 058 /** 059 * The identifier of the Job submitted. 060 */ 061 public static final RequiredParameter<String> JOB_IDENTIFIER = new RequiredParameter<>(); 062 063 /** 064 * The file containing a list of remote ssh nodes (i.e. `username@147.0.23.14`), separated by newlines. 065 */ 066 public static final RequiredParameter<String> NODE_LIST_FILE_PATH = new RequiredParameter<>(); 067 /** 068 * Set of objects containing information about the nodes. 069 */ 070 public static final RequiredParameter<String> NODE_INFO_SET = new RequiredParameter<>(); 071 072 /** 073 * Folder to save the shaded jar for the remote nodes. 074 */ 075 public static final OptionalParameter<String> NODE_FOLDER = new OptionalParameter<>(); 076 077 /** 078 * SSh port number. 079 */ 080 public static final OptionalParameter<Integer> SSH_PORT_NUM = new OptionalParameter<>(); 081 082 public static final ConfigurationModule CONF = new StandaloneDriverConfiguration() 083 .bindImplementation(ResourceLaunchHandler.class, StandaloneResourceLaunchHandler.class) 084 .bindImplementation(ResourceRequestHandler.class, StandaloneResourceRequestHandler.class) 085 .bindImplementation(ResourceReleaseHandler.class, StandaloneResourceReleaseHandler.class) 086 .bindImplementation(ResourceManagerStartHandler.class, StandaloneResourceManagerStartHandler.class) 087 .bindImplementation(ResourceManagerStopHandler.class, StandaloneResourceManagerStopHandler.class) 088 .bindNamedParameter(ClientRemoteIdentifier.class, CLIENT_REMOTE_IDENTIFIER) 089 .bindNamedParameter(ErrorHandlerRID.class, CLIENT_REMOTE_IDENTIFIER) 090 .bindNamedParameter(JobIdentifier.class, JOB_IDENTIFIER) 091 .bindNamedParameter(LaunchID.class, JOB_IDENTIFIER) 092 .bindNamedParameter(RootFolder.class, ROOT_FOLDER) 093 .bindNamedParameter(NodeListFilePath.class, NODE_LIST_FILE_PATH) 094 .bindNamedParameter(NodeFolder.class, NODE_FOLDER) 095 .bindNamedParameter(SshPortNum.class, SSH_PORT_NUM) 096 .bindNamedParameter(JVMHeapSlack.class, JVM_HEAP_SLACK) 097 .bindSetEntry(NodeInfoSet.class, NODE_INFO_SET) 098 .bindImplementation(RuntimeClasspathProvider.class, LocalClasspathProvider.class) 099 .build(); 100}