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.common.driver; 020 021import org.apache.reef.annotations.audience.ClientSide; 022import org.apache.reef.annotations.audience.Private; 023import org.apache.reef.driver.catalog.ResourceCatalog; 024import org.apache.reef.driver.client.JobMessageObserver; 025import org.apache.reef.driver.evaluator.EvaluatorRequestor; 026import org.apache.reef.driver.parameters.DriverIdleSources; 027import org.apache.reef.runtime.common.driver.api.RuntimeParameters; 028import org.apache.reef.runtime.common.driver.catalog.ResourceCatalogImpl; 029import org.apache.reef.runtime.common.driver.client.ClientManager; 030import org.apache.reef.runtime.common.driver.client.JobMessageObserverImpl; 031import org.apache.reef.runtime.common.driver.idle.ClockIdlenessSource; 032import org.apache.reef.runtime.common.driver.idle.EventHandlerIdlenessSource; 033import org.apache.reef.runtime.common.driver.resourcemanager.NodeDescriptorHandler; 034import org.apache.reef.runtime.common.driver.resourcemanager.ResourceAllocationHandler; 035import org.apache.reef.runtime.common.driver.resourcemanager.ResourceManagerStatus; 036import org.apache.reef.runtime.common.driver.resourcemanager.ResourceStatusHandler; 037import org.apache.reef.tang.formats.ConfigurationModule; 038import org.apache.reef.tang.formats.ConfigurationModuleBuilder; 039import org.apache.reef.wake.time.Clock; 040 041/** 042 * ConfigurationModule for driver runtime. 043 */ 044@Private 045@ClientSide 046public final class DriverRuntimeConfiguration extends ConfigurationModuleBuilder { 047 048 public static final ConfigurationModule CONF = new DriverRuntimeConfiguration() 049 // Resource Catalog 050 .bindImplementation(ResourceCatalog.class, ResourceCatalogImpl.class) 051 052 // JobMessageObserver 053 .bindImplementation(EvaluatorRequestor.class, EvaluatorRequestorImpl.class) // requesting evaluators 054 .bindImplementation(JobMessageObserver.class, JobMessageObserverImpl.class) // sending message to job client 055 056 // Client manager 057 .bindNamedParameter(DriverRuntimeConfigurationOptions.JobControlHandler.class, ClientManager.class) 058 059 // Bind the resourcemanager parameters 060 .bindNamedParameter(RuntimeParameters.NodeDescriptorHandler.class, NodeDescriptorHandler.class) 061 .bindNamedParameter(RuntimeParameters.ResourceAllocationHandler.class, ResourceAllocationHandler.class) 062 .bindNamedParameter(RuntimeParameters.ResourceStatusHandler.class, ResourceStatusHandler.class) 063 .bindNamedParameter(RuntimeParameters.RuntimeStatusHandler.class, ResourceManagerStatus.class) 064 065 // Bind to the Clock 066 .bindSetEntry(Clock.RuntimeStartHandler.class, DriverRuntimeStartHandler.class) 067 .bindSetEntry(Clock.RuntimeStopHandler.class, DriverRuntimeStopHandler.class) 068 069 // Bind the idle handlers 070 .bindSetEntry(DriverIdleSources.class, ClockIdlenessSource.class) 071 .bindSetEntry(DriverIdleSources.class, EventHandlerIdlenessSource.class) 072 .bindSetEntry(DriverIdleSources.class, ResourceManagerStatus.class) 073 .bindSetEntry(Clock.IdleHandler.class, ClockIdlenessSource.class) 074 075 .build(); 076}