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.multi.driver; 020 021import org.apache.reef.annotations.audience.Private; 022import org.apache.reef.annotations.audience.RuntimeAuthor; 023import org.apache.reef.runtime.common.driver.api.*; 024import org.apache.reef.runtime.common.driver.parameters.ClientRemoteIdentifier; 025import org.apache.reef.runtime.common.driver.parameters.DefinedRuntimes; 026import org.apache.reef.runtime.common.driver.parameters.JobIdentifier; 027import org.apache.reef.runtime.common.launch.parameters.LaunchID; 028import org.apache.reef.runtime.multi.client.parameters.SerializedRuntimeDefinition; 029import org.apache.reef.tang.formats.ConfigurationModule; 030import org.apache.reef.tang.formats.ConfigurationModuleBuilder; 031import org.apache.reef.tang.formats.OptionalParameter; 032import org.apache.reef.tang.formats.RequiredParameter; 033 034/** 035 * ConfigurationModule for the multi-runtime Driver. 036 */ 037@Private 038@RuntimeAuthor 039public class MultiRuntimeDriverConfiguration extends ConfigurationModuleBuilder { 040 041 /** 042 * Serialized runtime configuration. 043 */ 044 public static final RequiredParameter<String> SERIALIZED_RUNTIME_DEFINITION = new RequiredParameter<>(); 045 046 /** 047 * Serialized runtime configuration. 048 */ 049 public static final RequiredParameter<String> RUNTIME_NAMES = new RequiredParameter<>(); 050 051 /** 052 * The identifier of the Job submitted. 053 */ 054 public static final RequiredParameter<String> JOB_IDENTIFIER = new RequiredParameter<>(); 055 056 /** 057 * The identifier of the Job submitted. 058 */ 059 public static final OptionalParameter<String> CLIENT_REMOTE_IDENTIFIER = new OptionalParameter<>(); 060 061 /** 062 * Hybrid driver configuration. 063 */ 064 public static final ConfigurationModule CONF = new MultiRuntimeDriverConfiguration() 065 .bindImplementation(ResourceLaunchHandler.class, MultiRuntimeResourceLaunchHandler.class) 066 .bindImplementation(ResourceRequestHandler.class, MultiRuntimeResourceRequestHandler.class) 067 .bindImplementation(ResourceReleaseHandler.class, MultiRuntimeResourceReleaseHandler.class) 068 .bindImplementation(ResourceManagerStartHandler.class, MultiRuntimeResourceManagerStartHandler.class) 069 .bindImplementation(ResourceManagerStopHandler.class, MultiRuntimeResourceManagerStopHandler.class) 070 .bindNamedParameter(SerializedRuntimeDefinition.class, SERIALIZED_RUNTIME_DEFINITION) 071 .bindNamedParameter(LaunchID.class, JOB_IDENTIFIER) 072 .bindNamedParameter(JobIdentifier.class, JOB_IDENTIFIER) 073 .bindNamedParameter(ClientRemoteIdentifier.class, CLIENT_REMOTE_IDENTIFIER) 074 .bindSetEntry(DefinedRuntimes.class, RUNTIME_NAMES) 075 .build(); 076}