Ejemplo n.º 1
0
        /// <summary>
        /// Task host base class to hold the common stuff of both mapper and update tasks
        /// </summary>
        /// <param name="groupCommunicationsClient">Group Communication Client</param>
        /// <param name="taskCloseCoordinator">The class that handles the close event for the task</param>
        /// <param name="invokeGc">specify if want to invoke garbage collector or not </param>
        protected TaskHostBase(
            IGroupCommClient groupCommunicationsClient,
            TaskCloseCoordinator taskCloseCoordinator,
            bool invokeGc)
        {
            _groupCommunicationsClient = groupCommunicationsClient;
            _communicationGroupClient  = groupCommunicationsClient.GetCommunicationGroup(IMRUConstants.CommunicationGroupName);

            _invokeGc             = invokeGc;
            _taskCloseCoordinator = taskCloseCoordinator;
            _cancellationSource   = new CancellationTokenSource();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Task host base class to hold the common stuff of both mapper and update tasks
        /// </summary>
        /// <param name="groupCommunicationsClient">Group Communication Client</param>
        /// <param name="taskCloseCoordinator">The class that handles the close event for the task</param>
        /// <param name="invokeGc">specify if want to invoke garbage collector or not </param>
        protected TaskHostBase(
            IGroupCommClient groupCommunicationsClient,
            TaskCloseCoordinator taskCloseCoordinator,
            bool invokeGc)
        {
            Logger.Log(Level.Info, "Entering TaskHostBase constructor with machine status {0}.", _machineStatus.ToString());
            _groupCommunicationsClient = groupCommunicationsClient;
            _communicationGroupClient  = groupCommunicationsClient.GetCommunicationGroup(IMRUConstants.CommunicationGroupName);

            _invokeGc             = invokeGc;
            _taskCloseCoordinator = taskCloseCoordinator;
            _cancellationSource   = new CancellationTokenSource();
        }
Ejemplo n.º 3
0
 private MapTaskHost(
     IMapFunction <TMapInput, TMapOutput> mapTask,
     IGroupCommClient groupCommunicationsClient,
     TaskCloseCoordinator taskCloseCoordinator,
     [Parameter(typeof(InvokeGC))] bool invokeGc,
     [Parameter(typeof(TaskConfigurationOptions.Identifier))] string taskId) :
     base(groupCommunicationsClient, taskCloseCoordinator, invokeGc)
 {
     Logger.Log(Level.Info, "Entering constructor of MapTaskHost for task id {0}", taskId);
     _mapTask = mapTask;
     _dataAndMessageReceiver =
         _communicationGroupClient.GetBroadcastReceiver <MapInputWithControlMessage <TMapInput> >(IMRUConstants.BroadcastOperatorName);
     _dataReducer = _communicationGroupClient.GetReduceSender <TMapOutput>(IMRUConstants.ReduceOperatorName);
     Logger.Log(Level.Info, "MapTaskHost initialized.");
 }
Ejemplo n.º 4
0
        private MapTaskHost(
            IMapFunction <TMapInput, TMapOutput> mapTask,
            IGroupCommClient groupCommunicationsClient,
            TaskCloseCoordinator taskCloseCoordinator,
            [Parameter(typeof(InvokeGC))] bool invokeGC)
        {
            _mapTask = mapTask;
            _groupCommunicationsClient = groupCommunicationsClient;
            var cg = groupCommunicationsClient.GetCommunicationGroup(IMRUConstants.CommunicationGroupName);

            _dataAndMessageReceiver =
                cg.GetBroadcastReceiver <MapInputWithControlMessage <TMapInput> >(IMRUConstants.BroadcastOperatorName);
            _dataReducer          = cg.GetReduceSender <TMapOutput>(IMRUConstants.ReduceOperatorName);
            _invokeGC             = invokeGC;
            _taskCloseCoordinator = taskCloseCoordinator;
        }
Ejemplo n.º 5
0
        private UpdateTaskHost(
            IUpdateFunction <TMapInput, TMapOutput, TResult> updateTask,
            IGroupCommClient groupCommunicationsClient,
            IIMRUResultHandler <TResult> resultHandler,
            TaskCloseCoordinator taskCloseCoordinator,
            [Parameter(typeof(InvokeGC))] bool invokeGC)
        {
            _updateTask = updateTask;
            _groupCommunicationsClient = groupCommunicationsClient;
            var cg = groupCommunicationsClient.GetCommunicationGroup(IMRUConstants.CommunicationGroupName);

            _dataAndControlMessageSender =
                cg.GetBroadcastSender <MapInputWithControlMessage <TMapInput> >(IMRUConstants.BroadcastOperatorName);
            _dataReceiver         = cg.GetReduceReceiver <TMapOutput>(IMRUConstants.ReduceOperatorName);
            _invokeGC             = invokeGC;
            _resultHandler        = resultHandler;
            _taskCloseCoordinator = taskCloseCoordinator;
        }
Ejemplo n.º 6
0
 private UpdateTaskHost(
     IUpdateFunction <TMapInput, TMapOutput, TResult> updateTask,
     IGroupCommClient groupCommunicationsClient,
     IIMRUResultHandler <TResult> resultHandler,
     TaskCloseCoordinator taskCloseCoordinator,
     [Parameter(typeof(InvokeGC))] bool invokeGc,
     [Parameter(typeof(TaskConfigurationOptions.Identifier))] string taskId) :
     base(groupCommunicationsClient, taskCloseCoordinator, invokeGc)
 {
     Logger.Log(Level.Info, "Entering constructor of UpdateTaskHost for task id {0}", taskId);
     _updateTask = updateTask;
     _dataAndControlMessageSender =
         _communicationGroupClient.GetBroadcastSender <MapInputWithControlMessage <TMapInput> >(IMRUConstants.BroadcastOperatorName);
     _dataReceiver  = _communicationGroupClient.GetReduceReceiver <TMapOutput>(IMRUConstants.ReduceOperatorName);
     _resultHandler = resultHandler;
     Logger.Log(Level.Info, "$$$$_resultHandler." + _resultHandler.GetType().AssemblyQualifiedName);
     Logger.Log(Level.Info, "UpdateTaskHost initialized.");
 }