예제 #1
0
        //update status of rela
        public void resultSentToClient(int nodeId, int splitId, string nodeURL)
        {
            /*A failed node sending its split*/
            if (!existingWorkerMap.ContainsKey(nodeId))
            {
                Console.WriteLine("Tracker received a completed split from recovered node");
                WorkerDetails workerObj = getWorker(nodeId, nodeURL);
                existingWorkerMap.Add(nodeId, workerObj);
                // requestWorkerStatus(nodeId);

                //retrieve his status and send split if he has no job
                WorkerCommunicator communicator = new WorkerCommunicator();
                Dictionary <StatusType, List <int> > statusOfWorker = communicator.getRecoveredStatus(nodeURL);
                Dictionary <StatusType, List <int> > updatedStatus  = getStatusForWorker(statusOfWorker, nodeId, nodeURL);
                communicator.updateRecoveredWorker(updatedStatus, nodeURL);
                notifyWorkersAboutUnfreezed(nodeId, nodeURL);
            }

            lock (taskList[splitId])
            {
                Common.Logger().LogInfo("*************************************", string.Empty, string.Empty);
                foreach (var item in taskList)
                {
                    Common.Logger().LogInfo(" Split ID= " + item.Key + " WorkerID = " + item.Value.WorkerId + " Status= " + item.Value.StatusType.ToString(), string.Empty, string.Empty);
                }
                taskList[splitId].StatusType = StatusType.COMPLETED;
                existingWorkerMap[nodeId].ProcessedSplits.Add(splitId);
            }

            if (existingWorkerMap[nodeId].State == WorkerState.ABOUT_TO_IDLE)
            {
                existingWorkerMap[nodeId].State = WorkerState.IDLE;
                ReplaceSlowTasks(nodeId);
            }
        }
예제 #2
0
        public void notifyWorkerRecovery(int workerID, string nodeURL, List <int> processingSplits, List <int> alreadySentSplits)
        {
            WorkerCommunicator communicator = new WorkerCommunicator();
            Dictionary <StatusType, List <int> > statusOfWorker = communicator.getRecoveredStatus(nodeURL);
            Dictionary <StatusType, List <int> > updatedStatus  = trackerTask.getStatusForWorker(statusOfWorker, workerId, nodeURL);

            communicator.updateRecoveredWorker(updatedStatus, nodeURL);
        }