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