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@Private 042@ClientSide 043public final class DriverRuntimeConfiguration extends ConfigurationModuleBuilder { 044 045 public static final ConfigurationModule CONF = new DriverRuntimeConfiguration() 046 // Resource Catalog 047 .bindImplementation(ResourceCatalog.class, ResourceCatalogImpl.class) 048 049 // JobMessageObserver 050 .bindImplementation(EvaluatorRequestor.class, EvaluatorRequestorImpl.class) // requesting evaluators 051 .bindImplementation(JobMessageObserver.class, JobMessageObserverImpl.class) // sending message to job client 052 053 // Client manager 054 .bindNamedParameter(DriverRuntimeConfigurationOptions.JobControlHandler.class, ClientManager.class) 055 056 // Bind the resourcemanager parameters 057 .bindNamedParameter(RuntimeParameters.NodeDescriptorHandler.class, NodeDescriptorHandler.class) 058 .bindNamedParameter(RuntimeParameters.ResourceAllocationHandler.class, ResourceAllocationHandler.class) 059 .bindNamedParameter(RuntimeParameters.ResourceStatusHandler.class, ResourceStatusHandler.class) 060 .bindNamedParameter(RuntimeParameters.RuntimeStatusHandler.class, ResourceManagerStatus.class) 061 062 // Bind to the Clock 063 .bindSetEntry(Clock.RuntimeStartHandler.class, DriverRuntimeStartHandler.class) 064 .bindSetEntry(Clock.RuntimeStopHandler.class, DriverRuntimeStopHandler.class) 065 066 // Bind the idle handlers 067 .bindSetEntry(DriverIdleSources.class, ClockIdlenessSource.class) 068 .bindSetEntry(DriverIdleSources.class, EventHandlerIdlenessSource.class) 069 .bindSetEntry(DriverIdleSources.class, ResourceManagerStatus.class) 070 .bindSetEntry(Clock.IdleHandler.class, ClockIdlenessSource.class) 071 072 .build(); 073}