This project has retired. For details please refer to its Attic page.
Source code
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.vortex.driver;
020
021import org.apache.reef.annotations.Unstable;
022import org.apache.reef.annotations.audience.DriverSide;
023import org.apache.reef.tang.annotations.Name;
024import org.apache.reef.tang.annotations.NamedParameter;
025import org.apache.reef.tang.formats.*;
026import org.apache.reef.vortex.api.VortexStart;
027
028/**
029 * Vortex Master configuration.
030 */
031@Unstable
032@DriverSide
033public final class VortexMasterConf extends ConfigurationModuleBuilder {
034  /**
035   * Number of Workers.
036   */
037  @NamedParameter(doc = "Number of Workers")
038  final class WorkerNum implements Name<Integer> {
039  }
040
041  /**
042   * Worker Memory.
043   */
044  @NamedParameter(doc = "Worker Memory")
045  final class WorkerMem implements Name<Integer> {
046  }
047
048  /**
049   * Worker Cores.
050   */
051  @NamedParameter(doc = "Worker Cores")
052  final class WorkerCores implements Name<Integer> {
053  }
054
055  /**
056   * Worker Capacity.
057   */
058  @NamedParameter(doc = "Worker Capacity")
059  final class WorkerCapacity implements Name<Integer> {
060  }
061
062  /**
063   * Number of Vortex Start Threads.
064   */
065  @NamedParameter(doc = "Number of Vortex Start Threads", default_value = "1")
066  final class NumberOfVortexStartThreads implements Name<Integer> {
067  }
068
069  /**
070   * Size of threadpool for callbacks on {@link org.apache.reef.vortex.api.VortexFuture}.
071   */
072  @NamedParameter(doc = "Size of threadpool for callbacks on VortexFuture.", default_value = "10")
073  final class CallbackThreadPoolSize implements Name<Integer> {
074  }
075
076  /**
077   * Number of Workers.
078   */
079  public static final RequiredParameter<Integer> WORKER_NUM = new RequiredParameter<>();
080
081  /**
082   * Worker Memory.
083   */
084  public static final RequiredParameter<Integer> WORKER_MEM = new RequiredParameter<>();
085
086  /**
087   * Worker Cores.
088   */
089  public static final RequiredParameter<Integer> WORKER_CORES = new RequiredParameter<>();
090
091  /**
092   * Worker Cores.
093   */
094  public static final OptionalParameter<Integer> WORKER_CAPACITY = new OptionalParameter<>();
095
096  /**
097   * Vortex Start.
098   */
099  public static final RequiredImpl<VortexStart> VORTEX_START = new RequiredImpl<>();
100
101  /**
102   * Number of Vortex Start threads.
103   */
104  public static final OptionalParameter<Integer> NUM_OF_VORTEX_START_THREAD = new OptionalParameter<>();
105
106  /**
107   * Size of threadpool for callbacks on VortexFuture.
108   */
109  public static final OptionalParameter<Integer> FUTURE_CALLBACK_THREAD_POOL_SIZE = new OptionalParameter<>();
110
111  /**
112   * Vortex Master configuration.
113   */
114  public static final ConfigurationModule CONF = new VortexMasterConf()
115      .bindNamedParameter(WorkerNum.class, WORKER_NUM)
116      .bindNamedParameter(WorkerMem.class, WORKER_MEM)
117      .bindNamedParameter(WorkerCores.class, WORKER_CORES)
118      .bindNamedParameter(WorkerCapacity.class, WORKER_CAPACITY)
119      .bindImplementation(VortexStart.class, VORTEX_START)
120      .bindNamedParameter(NumberOfVortexStartThreads.class, NUM_OF_VORTEX_START_THREAD)
121      .bindNamedParameter(CallbackThreadPoolSize.class, FUTURE_CALLBACK_THREAD_POOL_SIZE)
122      .build();
123}