Exemple #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);
            }
        }
Exemple #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);
        }
Exemple #3
0
        //will be called by puppet master

        public Boolean initWorker(WorkerMetadata workerMetadata)
        {
            serviceUrl = workerMetadata.ServiceURL;
            startWorker();
            WorkerCommunicator communicator = new WorkerCommunicator();

            this.WorkerId = workerMetadata.WorkerId;
            // workerTask = new WorkerTask(WorkerId);

            if (workerMetadata.EntryURL == null || workerMetadata.EntryURL == String.Empty)//this is the first worker
            {
                addNewWorker(workerMetadata.WorkerId, workerMetadata.ServiceURL);
            }
            else//connect to entryWorker and get urlList
            {
                existingWorkerMap = communicator.getExistingWorkerURLList(workerMetadata.EntryURL);
                //notify all others about entry
                communicator.notifyExistingWorkers(workerId, workerMetadata.ServiceURL, existingWorkerMap);
                addNewWorker(workerMetadata.WorkerId, workerMetadata.ServiceURL); //add self
            }

            // startWorkerTasks();
            return(true);
        }