org.apache.reef.tang.annotations.Parameter Java Examples

The following examples show how to use org.apache.reef.tang.annotations.Parameter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ThreadPoolStage.java    From reef with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs a thread-pool stage.
 *
 * @param name         the stage name
 * @param handler      the event handler to execute
 * @param numThreads   the number of threads to use
 * @param errorHandler the error handler
 * @throws WakeRuntimeException
 */
@Inject
public ThreadPoolStage(@Parameter(StageName.class) final String name,
                       @Parameter(StageHandler.class) final EventHandler<T> handler,
                       @Parameter(NumberOfThreads.class) final int numThreads,
                       @Parameter(ErrorHandler.class) final EventHandler<Throwable> errorHandler) {
  super(name);
  this.handler = handler;
  this.errorHandler = errorHandler;
  if (numThreads <= 0) {
    throw new WakeRuntimeException(name + " numThreads " + numThreads + " is less than or equal to 0");
  }
  this.numThreads = numThreads;
  this.executor = Executors.newFixedThreadPool(numThreads, new DefaultThreadFactory(name));
  StageManager.instance().register(this);
}
 
Example #2
Source File: RuntimeClock.java    From reef with Apache License 2.0 6 votes vote down vote up
@Inject
private RuntimeClock(
    final Timer timer,
    @Parameter(Clock.StartHandler.class)
        final InjectionFuture<Set<EventHandler<StartTime>>> startHandler,
    @Parameter(Clock.StopHandler.class)
        final InjectionFuture<Set<EventHandler<StopTime>>> stopHandler,
    @Parameter(Clock.RuntimeStartHandler.class)
        final InjectionFuture<Set<EventHandler<RuntimeStart>>> runtimeStartHandler,
    @Parameter(Clock.RuntimeStopHandler.class)
        final InjectionFuture<Set<EventHandler<RuntimeStop>>> runtimeStopHandler,
    @Parameter(Clock.IdleHandler.class)
        final InjectionFuture<Set<EventHandler<IdleClock>>> idleHandler) {

  this.timer = timer;
  this.startHandler = startHandler;
  this.stopHandler = stopHandler;
  this.runtimeStartHandler = runtimeStartHandler;
  this.runtimeStopHandler = runtimeStopHandler;
  this.idleHandler = idleHandler;

  LOG.log(Level.FINE, "RuntimeClock instantiated.");
}
 
Example #3
Source File: HttpServerReefEventHandler.java    From reef with Apache License 2.0 6 votes vote down vote up
@Inject
public HttpServerReefEventHandler(
    final ReefEventStateManager reefStateManager,
    @Parameter(ClientCloseHandlers.class) final Set<EventHandler<Void>> clientCloseHandlers,
    @Parameter(LogLevelName.class) final String logLevel,
    final LoggingScopeFactory loggingScopeFactory,
    final REEFFileNames reefFileNames,
    final InjectionFuture<ProgressProvider> progressProvider) {
  this.reefStateManager = reefStateManager;
  this.clientCloseHandlers = clientCloseHandlers;
  this.loggingScopeFactory = loggingScopeFactory;
  this.logLevelPrefix = new StringBuilder().append(logLevel).append(": ").toString();
  this.progressProvider = progressProvider;
  driverStdoutFile = reefFileNames.getDriverStdoutFileName();
  driverStderrFile = reefFileNames.getDriverStderrFileName();
}
 
Example #4
Source File: NcsMessageEnvironment.java    From incubator-nemo with Apache License 2.0 6 votes vote down vote up
@Inject
private NcsMessageEnvironment(
  final NetworkConnectionService networkConnectionService,
  final IdentifierFactory idFactory,
  @Parameter(MessageParameters.SenderId.class) final String senderId) {
  this.networkConnectionService = networkConnectionService;
  this.idFactory = idFactory;
  this.senderId = senderId;
  this.replyFutureMap = new ReplyFutureMap<>();
  this.listenerConcurrentMap = new ConcurrentHashMap<>();
  this.receiverToConnectionMap = new ConcurrentHashMap<>();
  this.connectionFactory = networkConnectionService.registerConnectionFactory(
    idFactory.getNewInstance(NCS_CONN_FACTORY_ID),
    new ControlMessageCodec(),
    new NcsMessageHandler(),
    new NcsLinkListener(),
    idFactory.getNewInstance(senderId));
}
 
Example #5
Source File: LocalJobSubmissionHandler.java    From reef with Apache License 2.0 6 votes vote down vote up
@Inject
LocalJobSubmissionHandler(
    final ExecutorService executor,
    @Parameter(RootFolder.class) final String rootFolderName,
    final ConfigurationSerializer configurationSerializer,
    final REEFFileNames fileNames,

    final PreparedDriverFolderLauncher driverLauncher,
    final LoggingScopeFactory loggingScopeFactory,
    final DriverConfigurationProvider driverConfigurationProvider) {

  this.executor = executor;
  this.configurationSerializer = configurationSerializer;
  this.fileNames = fileNames;

  this.driverLauncher = driverLauncher;
  this.driverConfigurationProvider = driverConfigurationProvider;
  this.rootFolderName = new File(rootFolderName).getAbsolutePath();
  this.loggingScopeFactory = loggingScopeFactory;

  LOG.log(Level.FINE, "Instantiated 'LocalJobSubmissionHandler'");
}
 
Example #6
Source File: YarnJobSubmissionClient.java    From reef with Apache License 2.0 6 votes vote down vote up
@Inject
private YarnJobSubmissionClient(
    @Parameter(DriverIsUnmanaged.class) final boolean isUnmanaged,
    @Parameter(DriverLaunchCommandPrefix.class) final List<String> commandPrefixList,
    final JobUploader uploader,
    final YarnConfiguration yarnConfiguration,
    final REEFFileNames fileNames,
    final ClasspathProvider classpath,
    final YarnProxyUser yarnProxyUser,
    final SecurityTokenProvider tokenProvider,
    final YarnSubmissionParametersFileGenerator jobSubmissionParametersGenerator,
    final SecurityTokensReader securityTokensReader) {

  this.isUnmanaged = isUnmanaged;
  this.commandPrefixList = commandPrefixList;
  this.uploader = uploader;
  this.fileNames = fileNames;
  this.yarnConfiguration = yarnConfiguration;
  this.classpath = classpath;
  this.yarnProxyUser = yarnProxyUser;
  this.tokenProvider = tokenProvider;
  this.jobSubmissionParametersGenerator = jobSubmissionParametersGenerator;
  this.securityTokensReader = securityTokensReader;
}
 
Example #7
Source File: YARNResourceLaunchHandler.java    From reef with Apache License 2.0 6 votes vote down vote up
@Inject
YARNResourceLaunchHandler(final Containers containers,
                          final InjectionFuture<YarnContainerManager> yarnContainerManager,
                          final EvaluatorSetupHelper evaluatorSetupHelper,
                          final REEFFileNames filenames,
                          @Parameter(JVMHeapSlack.class) final double jvmHeapSlack,
                          final SecurityTokenProvider tokenProvider) {
  this.jvmHeapFactor = 1.0 - jvmHeapSlack;
  LOG.log(Level.FINEST, "Instantiating 'YARNResourceLaunchHandler'");
  this.containers = containers;
  this.yarnContainerManager = yarnContainerManager;
  this.evaluatorSetupHelper = evaluatorSetupHelper;
  this.filenames = filenames;
  this.tokenProvider = tokenProvider;
  LOG.log(Level.FINE, "Instantiated 'YARNResourceLaunchHandler'");
}
 
Example #8
Source File: REEFImplementation.java    From reef with Apache License 2.0 6 votes vote down vote up
/**
 * @param jobSubmissionHandler
 * @param jobSubmissionHelper
 * @param jobStatusMessageHandler is passed only to make sure it is instantiated
 * @param runningJobs
 * @param clientWireUp
 * @param reefVersion provides the current version of REEF.
 * @param configurationProviders
 */
@Inject
private REEFImplementation(
      final JobSubmissionHandler jobSubmissionHandler,
      final JobSubmissionHelper jobSubmissionHelper,
      final JobStatusMessageHandler jobStatusMessageHandler,
      final RunningJobs runningJobs,
      final ClientWireUp clientWireUp,
      final LoggingScopeFactory loggingScopeFactory,
      final REEFVersion reefVersion,
      @Parameter(JobSubmittedHandler.class) final InjectionFuture<EventHandler<SubmittedJob>> jobSubmittedHandler,
      @Parameter(DriverConfigurationProviders.class) final Set<ConfigurationProvider> configurationProviders) {

  this.jobSubmissionHandler = jobSubmissionHandler;
  this.jobSubmittedHandler = jobSubmittedHandler;
  this.jobSubmissionHelper = jobSubmissionHelper;
  this.runningJobs = runningJobs;
  this.clientWireUp = clientWireUp;
  this.configurationProviders = configurationProviders;
  this.loggingScopeFactory = loggingScopeFactory;

  clientWireUp.performWireUp();
  reefVersion.logVersion();
}
 
Example #9
Source File: AzureUploader.java    From reef with Apache License 2.0 6 votes vote down vote up
@Inject
AzureUploader(
    @Parameter(AzureStorageAccountName.class) final String accountName,
    @Parameter(AzureStorageAccountKey.class) final String accountKey,
    @Parameter(AzureStorageAccountContainerName.class) final String azureStorageContainerName,
    @Parameter(AzureStorageBaseFolder.class) final String baseFolder)
    throws URISyntaxException, InvalidKeyException, StorageException {

  this.storageAccount = CloudStorageAccount.parse(getStorageConnectionString(accountName, accountKey));
  this.blobClient = this.storageAccount.createCloudBlobClient();
  this.azureStorageContainerName = azureStorageContainerName;
  this.container = this.blobClient.getContainerReference(azureStorageContainerName);
  this.container.createIfNotExists();
  this.baseFolder = baseFolder;

  LOG.log(Level.FINE, "Instantiated AzureUploader connected to azure storage account: {0}", accountName);
}
 
Example #10
Source File: Executor.java    From incubator-nemo with Apache License 2.0 6 votes vote down vote up
@Inject
private Executor(@Parameter(JobConf.ExecutorId.class) final String executorId,
                 final PersistentConnectionToMasterMap persistentConnectionToMasterMap,
                 final MessageEnvironment messageEnvironment,
                 final SerializerManager serializerManager,
                 final IntermediateDataIOFactory intermediateDataIOFactory,
                 final BroadcastManagerWorker broadcastManagerWorker,
                 final MetricManagerWorker metricMessageSender) {
  this.executorId = executorId;
  this.executorService = Executors.newCachedThreadPool(new BasicThreadFactory.Builder()
    .namingPattern("TaskExecutor thread-%d")
    .build());
  this.persistentConnectionToMasterMap = persistentConnectionToMasterMap;
  this.serializerManager = serializerManager;
  this.intermediateDataIOFactory = intermediateDataIOFactory;
  this.broadcastManagerWorker = broadcastManagerWorker;
  this.metricMessageSender = metricMessageSender;
  messageEnvironment.setupListener(MessageEnvironment.EXECUTOR_MESSAGE_LISTENER_ID, new ExecutorMessageReceiver());
}
 
Example #11
Source File: ByteTransportChannelInitializer.java    From incubator-nemo with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a netty channel initializer.
 *
 * @param pipeManagerWorker   provides handler for new contexts by remote executors
 * @param blockManagerWorker  provides handler for new contexts by remote executors
 * @param byteTransfer        provides channel caching
 * @param byteTransport       provides {@link io.netty.channel.group.ChannelGroup}
 * @param controlFrameEncoder encodes control frames
 * @param dataFrameEncoder    encodes data frames
 * @param localExecutorId     the id of this executor
 */
@Inject
private ByteTransportChannelInitializer(final InjectionFuture<PipeManagerWorker> pipeManagerWorker,
                                        final InjectionFuture<BlockManagerWorker> blockManagerWorker,
                                        final InjectionFuture<ByteTransfer> byteTransfer,
                                        final InjectionFuture<ByteTransport> byteTransport,
                                        final ControlFrameEncoder controlFrameEncoder,
                                        final DataFrameEncoder dataFrameEncoder,
                                        @Parameter(JobConf.ExecutorId.class) final String localExecutorId) {
  this.pipeManagerWorker = pipeManagerWorker;
  this.blockManagerWorker = blockManagerWorker;
  this.byteTransfer = byteTransfer;
  this.byteTransport = byteTransport;
  this.controlFrameEncoder = controlFrameEncoder;
  this.dataFrameEncoder = dataFrameEncoder;
  this.localExecutorId = localExecutorId;
}
 
Example #12
Source File: DataPlaneConf.java    From incubator-nemo with Apache License 2.0 6 votes vote down vote up
@Inject
private DataPlaneConf(@Parameter(JobConf.IORequestHandleThreadsTotal.class) final int numIOThreads,
                      @Parameter(JobConf.MaxNumDownloadsForARuntimeEdge.class) final int maxNumDownloads,
                      @Parameter(JobConf.ScheduleSerThread.class) final int scheduleSerThread,
                      @Parameter(JobConf.PartitionTransportServerPort.class) final int serverPort,
                      @Parameter(JobConf.PartitionTransportClientNumThreads.class) final int clientNumThreads,
                      @Parameter(JobConf.PartitionTransportServerBacklog.class) final int serverBackLog,
                      @Parameter(JobConf.PartitionTransportServerNumListeningThreads.class) final int listenThreads,
                      @Parameter(JobConf.PartitionTransportServerNumWorkingThreads.class) final int workThreads,
                      @Parameter(JobConf.ChunkSizeKb.class) final int chunkSizeKb) {
  this.numIOThreads = numIOThreads;
  this.maxNumDownloads = maxNumDownloads;
  this.scheduleSerThread = scheduleSerThread;
  this.serverPort = serverPort;
  this.clientNumThreads = clientNumThreads;
  this.serverBackLog = serverBackLog;
  this.listenThreads = listenThreads;
  this.workThreads = workThreads;
  this.chunkSizeKb = chunkSizeKb;
}
 
Example #13
Source File: ScatterReceiver.java    From reef with Apache License 2.0 6 votes vote down vote up
@Inject
public ScatterReceiver(@Parameter(CommunicationGroupName.class) final String groupName,
                       @Parameter(OperatorName.class) final String operName,
                       @Parameter(TaskConfigurationOptions.Identifier.class) final String selfId,
                       @Parameter(DataCodec.class) final Codec<T> dataCodec,
                       @Parameter(DriverIdentifierGroupComm.class) final String driverId,
                       @Parameter(TaskVersion.class) final int version,
                       final CommGroupNetworkHandler commGroupNetworkHandler,
                       final NetworkService<GroupCommunicationMessage> netService,
                       final CommunicationGroupServiceClient commGroupClient,
                       final ScatterDecoder scatterDecoder) {
  LOG.finest(operName + "has CommGroupHandler-" + commGroupNetworkHandler.toString());
  this.version = version;
  this.groupName = Utils.getClass(groupName);
  this.operName = Utils.getClass(operName);
  this.dataCodec = dataCodec;
  this.scatterDecoder = scatterDecoder;
  this.topology = new OperatorTopologyImpl(this.groupName, this.operName,
                                           selfId, driverId, new Sender(netService), version);
  this.commGroupClient = commGroupClient;
  commGroupNetworkHandler.register(this.operName, this);
}
 
Example #14
Source File: BroadcastSender.java    From reef with Apache License 2.0 6 votes vote down vote up
@Inject
public BroadcastSender(@Parameter(CommunicationGroupName.class) final String groupName,
                       @Parameter(OperatorName.class) final String operName,
                       @Parameter(TaskConfigurationOptions.Identifier.class) final String selfId,
                       @Parameter(DataCodec.class) final Codec<T> dataCodec,
                       @Parameter(DriverIdentifierGroupComm.class) final String driverId,
                       @Parameter(TaskVersion.class) final int version,
                       final CommGroupNetworkHandler commGroupNetworkHandler,
                       final NetworkService<GroupCommunicationMessage> netService,
                       final CommunicationGroupServiceClient commGroupClient) {
  super();
  this.version = version;
  LOG.finest(operName + "has CommGroupHandler-" + commGroupNetworkHandler.toString());
  this.groupName = Utils.getClass(groupName);
  this.operName = Utils.getClass(operName);
  this.dataCodec = dataCodec;
  this.commGroupNetworkHandler = commGroupNetworkHandler;
  this.netService = netService;
  this.sender = new Sender(this.netService);
  this.topology = new OperatorTopologyImpl(this.groupName, this.operName, selfId, driverId, sender, version);
  this.commGroupNetworkHandler.register(this.operName, this);
  this.commGroupClient = commGroupClient;
}
 
Example #15
Source File: ClientManager.java    From reef with Apache License 2.0 6 votes vote down vote up
@Inject
ClientManager(@Parameter(ClientCloseHandlers.class)
              final InjectionFuture<Set<EventHandler<Void>>> clientCloseHandlers,
              @Parameter(ClientCloseWithMessageHandlers.class)
              final InjectionFuture<Set<EventHandler<byte[]>>> clientCloseWithMessageHandlers,
              @Parameter(ClientMessageHandlers.class)
              final InjectionFuture<Set<EventHandler<byte[]>>> clientMessageHandlers,
              @Parameter(ClientRemoteIdentifier.class) final String clientRID,
              final RemoteManager remoteManager,
              final DriverStatusManager driverStatusManager) {
  this.driverStatusManager = driverStatusManager;
  this.clientCloseHandlers = clientCloseHandlers;
  this.clientCloseWithMessageHandlers = clientCloseWithMessageHandlers;
  this.clientMessageHandlers = clientMessageHandlers;

  if (!clientRID.equals(ClientRemoteIdentifier.NONE)) {
    remoteManager.registerHandler(clientRID, ClientRuntimeProtocol.JobControlProto.class, this);
  } else {
    LOG.log(Level.FINE, "Not registering a handler for JobControlProto, as there is no client.");
  }
}
 
Example #16
Source File: GatherSender.java    From reef with Apache License 2.0 6 votes vote down vote up
@Inject
public GatherSender(@Parameter(CommunicationGroupName.class) final String groupName,
                    @Parameter(OperatorName.class) final String operName,
                    @Parameter(TaskConfigurationOptions.Identifier.class) final String selfId,
                    @Parameter(DataCodec.class) final Codec<T> dataCodec,
                    @Parameter(DriverIdentifierGroupComm.class) final String driverId,
                    @Parameter(TaskVersion.class) final int version,
                    final CommGroupNetworkHandler commGroupNetworkHandler,
                    final NetworkService<GroupCommunicationMessage> netService,
                    final CommunicationGroupServiceClient commGroupClient) {
  LOG.finest(operName + "has CommGroupHandler-" + commGroupNetworkHandler.toString());
  this.version = version;
  this.groupName = Utils.getClass(groupName);
  this.operName = Utils.getClass(operName);
  this.dataCodec = dataCodec;
  this.netService = netService;
  this.topology = new OperatorTopologyImpl(this.groupName, this.operName,
                                           selfId, driverId, new Sender(netService), version);
  this.commGroupClient = commGroupClient;
  commGroupNetworkHandler.register(this.operName, this);
}
 
Example #17
Source File: GrpcMessageEnvironment.java    From nemo with Apache License 2.0 6 votes vote down vote up
@Inject
private GrpcMessageEnvironment(
    final LocalAddressProvider localAddressProvider,
    final NameResolver nameResolver,
    final IdentifierFactory idFactory,
    @Parameter(MessageParameters.SenderId.class) final String localSenderId) {
  this.nameResolver = nameResolver;
  this.idFactory = idFactory;
  this.grpcServer = new GrpcMessageServer(localAddressProvider, nameResolver, idFactory, localSenderId);

  try {
    this.grpcServer.start();
  } catch (final Exception e) {
    LOG.warn("Failed to start grpc server", e);
    throw new RuntimeException(e);
  }
}
 
Example #18
Source File: SlaveTask.java    From reef with Apache License 2.0 6 votes vote down vote up
@Inject
public SlaveTask(
    final GroupCommClient groupCommClient,
    final ExampleList dataSet,
    final LossFunction lossFunction,
    @Parameter(ProbabilityOfFailure.class) final double pFailure,
    final StepSizes ts) {

  this.dataSet = dataSet;
  this.lossFunction = lossFunction;
  this.failureProb = pFailure;
  LOG.info("Using pFailure=" + this.failureProb);
  this.ts = ts;

  this.communicationGroup = groupCommClient.getCommunicationGroup(AllCommunicationGroup.class);
  this.controlMessageBroadcaster = communicationGroup.getBroadcastReceiver(ControlMessageBroadcaster.class);
  this.modelBroadcaster = communicationGroup.getBroadcastReceiver(ModelBroadcaster.class);
  this.lossAndGradientReducer = communicationGroup.getReduceSender(LossAndGradientReducer.class);
  this.modelAndDescentDirectionBroadcaster =
      communicationGroup.getBroadcastReceiver(ModelAndDescentDirectionBroadcaster.class);
  this.descentDirectionBroadcaster = communicationGroup.getBroadcastReceiver(DescentDirectionBroadcaster.class);
  this.lineSearchEvaluationsReducer = communicationGroup.getReduceSender(LineSearchEvaluationsReducer.class);
  this.minEtaBroadcaster = communicationGroup.getBroadcastReceiver(MinEtaBroadcaster.class);
}
 
Example #19
Source File: YarnJobSubmissionHandler.java    From reef with Apache License 2.0 6 votes vote down vote up
@Inject
YarnJobSubmissionHandler(
        @Parameter(JobQueue.class) final String defaultQueueName,
        @Parameter(DriverIsUnmanaged.class) final boolean isUnmanaged,
        final YarnConfiguration yarnConfiguration,
        final JobJarMaker jobJarMaker,
        final REEFFileNames fileNames,
        final ClasspathProvider classpath,
        final JobUploader uploader,
        final YarnProxyUser yarnProxyUser,
        final SecurityTokenProvider tokenProvider,
        final DriverConfigurationProvider driverConfigurationProvider) throws IOException {

  this.defaultQueueName = defaultQueueName;
  this.isUnmanaged = isUnmanaged;
  this.yarnConfiguration = yarnConfiguration;
  this.jobJarMaker = jobJarMaker;
  this.fileNames = fileNames;
  this.classpath = classpath;
  this.uploader = uploader;
  this.yarnProxyUser = yarnProxyUser;
  this.tokenProvider = tokenProvider;
  this.driverConfigurationProvider = driverConfigurationProvider;
}
 
Example #20
Source File: BlockManagerWorker.java    From nemo with Apache License 2.0 6 votes vote down vote up
@Inject
private BlockManagerWorker(@Parameter(JobConf.ExecutorId.class) final String executorId,
                           @Parameter(JobConf.IORequestHandleThreadsTotal.class) final int numThreads,
                           final MemoryStore memoryStore,
                           final SerializedMemoryStore serializedMemoryStore,
                           final LocalFileStore localFileStore,
                           final RemoteFileStore remoteFileStore,
                           final PersistentConnectionToMasterMap persistentConnectionToMasterMap,
                           final ByteTransfer byteTransfer,
                           final SerializerManager serializerManager) {
  this.executorId = executorId;
  this.memoryStore = memoryStore;
  this.serializedMemoryStore = serializedMemoryStore;
  this.localFileStore = localFileStore;
  this.remoteFileStore = remoteFileStore;
  this.persistentConnectionToMasterMap = persistentConnectionToMasterMap;
  this.byteTransfer = byteTransfer;
  this.backgroundExecutorService = Executors.newFixedThreadPool(numThreads);
  this.blockToRemainingRead = new ConcurrentHashMap<>();
  this.serializerManager = serializerManager;
  this.pendingBlockLocationRequest = new ConcurrentHashMap<>();
}
 
Example #21
Source File: RxSyncStage.java    From reef with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a Rx synchronous stage.
 *
 * @param name     the stage name
 * @param observer the observer
 */
@Inject
public RxSyncStage(@Parameter(StageName.class) final String name,
                   @Parameter(StageObserver.class) final Observer<T> observer) {
  super(name);
  this.observer = observer;
  StageManager.instance().register(this);
}
 
Example #22
Source File: TcpPortConfigurationProvider.java    From reef with Apache License 2.0 5 votes vote down vote up
@Inject
TcpPortConfigurationProvider(@Parameter(TcpPortRangeBegin.class) final int portRangeBegin,
                             @Parameter(TcpPortRangeCount.class) final int portRangeCount,
                             @Parameter(TcpPortRangeTryCount.class) final int portRangeTryCount) {
  this.portRangeBegin = portRangeBegin;
  this.portRangeCount = portRangeCount;
  this.portRangeTryCount = portRangeTryCount;
  LOG.log(Level.INFO, "Instantiating " + this.toString());
}
 
Example #23
Source File: TaskStatus.java    From reef with Apache License 2.0 5 votes vote down vote up
@Inject
TaskStatus(@Parameter(TaskConfigurationOptions.Identifier.class) final String taskId,
           @Parameter(ContextIdentifier.class) final String contextId,
           @Parameter(TaskConfigurationOptions.TaskMessageSources.class)
           final Set<TaskMessageSource> evaluatorMessageSources,
           final HeartBeatManager heartBeatManager,
           final ExceptionCodec exceptionCodec) {
  this.taskId = taskId;
  this.contextId = contextId;
  this.heartBeatManager = heartBeatManager;
  this.evaluatorMessageSources = evaluatorMessageSources;
  this.exceptionCodec = exceptionCodec;
}
 
Example #24
Source File: HeronMasterDriver.java    From incubator-heron with Apache License 2.0 5 votes vote down vote up
@Inject
public HeronMasterDriver(EvaluatorRequestor requestor,
                         final REEFFileNames fileNames,
                         @Parameter(Cluster.class) String cluster,
                         @Parameter(Role.class) String role,
                         @Parameter(TopologyName.class) String topologyName,
                         @Parameter(Environ.class) String env,
                         @Parameter(TopologyJar.class) String topologyJar,
                         @Parameter(TopologyPackageName.class) String topologyPackageName,
                         @Parameter(HeronCorePackageName.class) String heronCorePackageName,
                         @Parameter(HttpPort.class) int httpPort,
                         @Parameter(VerboseLogMode.class) boolean verboseMode)
    throws IOException {

  // REEF related initialization
  this.requestor = requestor;
  this.reefFileNames = fileNames;

  // Heron related initialization
  this.localHeronConfDir = ".";
  this.cluster = cluster;
  this.role = role;
  this.topologyName = topologyName;
  this.topologyPackageName = topologyPackageName;
  this.heronCorePackageName = heronCorePackageName;
  this.env = env;
  this.topologyJar = topologyJar;
  this.httpPort = httpPort;
  this.verboseMode = verboseMode;
  this.multiKeyWorkerMap = new MultiKeyWorkerMap();

  // This instance of Driver will be used for managing topology containers
  HeronMasterDriverProvider.setInstance(this);
}
 
Example #25
Source File: SchedulerDriver.java    From reef with Apache License 2.0 5 votes vote down vote up
@Inject
private SchedulerDriver(final EvaluatorRequestor requestor,
                        @Parameter(SchedulerREEF.Retain.class) final boolean retainable,
                        final Scheduler scheduler) {
  this.requestor = requestor;
  this.scheduler = scheduler;
  this.retainable = retainable;
}
 
Example #26
Source File: ConfigurableDirectoryTempFileCreator.java    From reef with Apache License 2.0 5 votes vote down vote up
@Inject
ConfigurableDirectoryTempFileCreator(
    @Parameter(TempFileRootFolder.class) final String rootFolder) throws IOException {
  this.tempFolderAsFile = new File(rootFolder);
  if (!this.tempFolderAsFile.exists() && !this.tempFolderAsFile.mkdirs()) {
    LOG.log(Level.WARNING, "Failed to create [{0}]", this.tempFolderAsFile.getAbsolutePath());
  }
  this.tempFolderAsPath = this.tempFolderAsFile.toPath();
  LOG.log(Level.FINE, "Temporary files and folders will be created in [{0}]",
      this.tempFolderAsFile.getAbsolutePath());
}
 
Example #27
Source File: FileEventStream.java    From reef with Apache License 2.0 5 votes vote down vote up
@Inject
private FileEventStream(@Parameter(Path.class) final String path) {
  this.dateFormat = new SimpleDateFormat("[yyyy.MM.dd HH:mm:ss.SSSS]");
  this.singleThreadedExecutor = new ThreadPoolStage<>(new RunnableExecutingHandler(), 1);

  try {
    final OutputStreamWriter writer = new OutputStreamWriter(
        new FileOutputStream(createFileWithPath(path)), Charset.forName("UTF-8"));
    this.printWriter = new PrintWriter(writer);
  } catch (final IOException e) {
    throw new RuntimeException(e);
  }
}
 
Example #28
Source File: FlatTopology.java    From reef with Apache License 2.0 5 votes vote down vote up
@Inject
private FlatTopology(@Parameter(GroupCommSenderStage.class) final EStage<GroupCommunicationMessage> senderStage,
                     @Parameter(CommGroupNameClass.class) final Class<? extends Name<String>> groupName,
                     @Parameter(OperatorNameClass.class) final Class<? extends Name<String>> operatorName,
                     @Parameter(DriverIdentifier.class) final String driverId) {
  this.senderStage = senderStage;
  this.groupName = groupName;
  this.operName = operatorName;
  this.driverId = driverId;
}
 
Example #29
Source File: TreeTopology.java    From reef with Apache License 2.0 5 votes vote down vote up
@Inject
private TreeTopology(@Parameter(GroupCommSenderStage.class) final EStage<GroupCommunicationMessage> senderStage,
                     @Parameter(CommGroupNameClass.class) final Class<? extends Name<String>> groupName,
                     @Parameter(OperatorNameClass.class) final Class<? extends Name<String>> operatorName,
                     @Parameter(DriverIdentifier.class) final String driverId,
                     @Parameter(TreeTopologyFanOut.class) final int fanOut) {
  this.senderStage = senderStage;
  this.groupName = groupName;
  this.operName = operatorName;
  this.driverId = driverId;
  this.fanOut = fanOut;
  LOG.config(getQualifiedName() + "Tree Topology running with a fan-out of " + fanOut);
}
 
Example #30
Source File: PoissonPoisonedTaskStartHandler.java    From reef with Apache License 2.0 5 votes vote down vote up
@Inject
PoissonPoisonedTaskStartHandler(
    @Parameter(CrashProbability.class) final double lambda, final Clock clock) {

  this.clock = clock;
  this.timeToCrash = new PoissonDistribution(lambda * 1000).sample();

  LOG.log(Level.INFO,
      "Created Poisson poison injector with prescribed dose: {0}. Crash in {1} msec.",
      new Object[]{lambda, this.timeToCrash});
}