Changeset 2c3ae5
- Timestamp:
- Aug 11, 2025, 5:45:18 PM (3 months ago)
- Branches:
- Candidate_v1.7.0, stable
- Children:
- e2f31d3
- Parents:
- 74d798
- git-author:
- Frederik Heber <frederik.heber@…> (07/13/25 21:35:10)
- git-committer:
- Frederik Heber <frederik.heber@…> (08/11/25 17:45:18)
- Location:
- ThirdParty/JobMarket/src/JobMarket/Pool
- Files:
-
- 3 edited
-
PoolGuard.cpp (modified) (9 diffs)
-
PoolGuard.hpp (modified) (2 diffs)
-
WorkerPool.hpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ThirdParty/JobMarket/src/JobMarket/Pool/PoolGuard.cpp
r74d798 r2c3ae5 65 65 { 66 66 if (WaitingOps == 0) { 67 LOG(1, "INFO: There are " << Last WorkerList.size() << " busy workers from last time, "68 << Current WorkerList.size() << " are currently busy.");67 LOG(1, "INFO: There are " << LastBusyWorkerList.size() << " busy workers from last time, " 68 << CurrentBusyWorkerList.size() << " are currently busy."); 69 69 // create a vector of workers to check 70 70 typedef std::set<WorkerAddress> CheckList_t; 71 71 CheckList_t currentworkers; 72 for (WorkerList_t::const_iterator iter = Last WorkerList.begin();73 iter != Last WorkerList.end();72 for (WorkerList_t::const_iterator iter = LastBusyWorkerList.begin(); 73 iter != LastBusyWorkerList.end(); 74 74 ++iter) { 75 75 const WorkerAddress &address = iter->first; 76 76 LOG(2, "DEBUG: Checking whether worker " << address << " is still busy ..."); 77 WorkerList_t::const_iterator currentiter = Current WorkerList.find(address);77 WorkerList_t::const_iterator currentiter = CurrentBusyWorkerList.find(address); 78 78 // check if worker was busy last time and on same job 79 if (currentiter != Current WorkerList.end()) {79 if (currentiter != CurrentBusyWorkerList.end()) { 80 80 LOG(2, "DEBUG: Worker " << address << " was busy last time on job " << iter->second << "."); 81 81 if (currentiter->second == iter->second) { … … 101 101 for(CheckList_t::const_iterator iter = currentworkers.begin(); 102 102 iter != currentworkers.end(); ++iter) { 103 const WorkerAddress &address = *iter; 104 LOG(1, "INFO: Checking whether " << address << " is alive."); 105 AsyncOperation *checkaliveWorkerOp = new CheckAliveWorkerOperation(connection, 106 boost::bind(&PoolGuard::checkAddress, this, address, _1), 107 boost::bind(&PoolGuard::printWorkerIsAlive, this, address), 108 boost::bind(&PoolGuard::removeFromPool, this, address)); 109 OpQueue.push_back(checkaliveWorkerOp, address); 110 ++WaitingOps; 103 CheckWorker(*iter); 104 } 105 LOG(1, "INFO: Checking on " << CurrentIdleWorkerList.size() << " idle workers."); 106 for(std::set<WorkerAddress>::const_iterator iter = CurrentIdleWorkerList.begin(); 107 iter != CurrentIdleWorkerList.end(); ++iter) { 108 CheckWorker(*iter); 111 109 } 112 110 } else { … … 114 112 } 115 113 // set old list to new list 116 Last WorkerList = CurrentWorkerList;114 LastBusyWorkerList = CurrentBusyWorkerList; 117 115 118 116 // set next check interval … … 126 124 } 127 125 126 void PoolGuard::CheckWorker(const WorkerAddress &address) 127 { 128 LOG(1, "INFO: Checking whether " << address << " is alive."); 129 AsyncOperation *checkaliveWorkerOp = new CheckAliveWorkerOperation(connection, 130 boost::bind(&PoolGuard::checkAddress, this, address, _1), 131 boost::bind(&PoolGuard::printWorkerIsAlive, this, address), 132 boost::bind(&PoolGuard::removeFromPool, this, address)); 133 OpQueue.push_back(checkaliveWorkerOp, address); 134 ++WaitingOps; 135 } 136 128 137 void PoolGuard::checkAddress( 129 138 const WorkerAddress trueaddress, … … 142 151 --WaitingOps; 143 152 // erase from our lists 144 Last WorkerList.erase(address);145 WorkerList_t::iterator iter = Current WorkerList.find(address);146 if ( iter != Current WorkerList.end()) {153 LastBusyWorkerList.erase(address); 154 WorkerList_t::iterator iter = CurrentBusyWorkerList.find(address); 155 if ( iter != CurrentBusyWorkerList.end()) { 147 156 const JobId_t jobid = iter->second; 148 Current WorkerList.erase(iter);157 CurrentBusyWorkerList.erase(iter); 149 158 // erase from pool 150 159 removeWorkerfunction(address); … … 160 169 std::pair<WorkerList_t::iterator, bool> inserter = 161 170 #endif 162 Current WorkerList.insert( std::make_pair(address, id) );171 CurrentBusyWorkerList.insert( std::make_pair(address, id) ); 163 172 ASSERT( inserter.second, 164 173 "PoolGuard::addBusyWorker() - worker "+toString(address)+" " … … 169 178 { 170 179 LOG(1, "INFO: Removing worker " << address << " as busy."); 171 WorkerList_t::iterator iter = Current WorkerList.find(address);172 if (iter != Current WorkerList.end()) {173 Current WorkerList.erase(address);174 Last WorkerList.erase(address);180 WorkerList_t::iterator iter = CurrentBusyWorkerList.find(address); 181 if (iter != CurrentBusyWorkerList.end()) { 182 CurrentBusyWorkerList.erase(address); 183 LastBusyWorkerList.erase(address); 175 184 } 176 185 } … … 188 197 timer.cancel(); 189 198 // clear internal list such that we may correctly be started again 190 Last WorkerList.clear();191 Current WorkerList.clear();199 LastBusyWorkerList.clear(); 200 CurrentBusyWorkerList.clear(); 192 201 } 193 202 … … 196 205 // set flag to true 197 206 CheckAtNextInterval = true; 198 // and check right away to fill Last WorkerList207 // and check right away to fill LastBusyWorkerList 199 208 checkWorkers(); 200 209 } -
ThirdParty/JobMarket/src/JobMarket/Pool/PoolGuard.hpp
r74d798 r2c3ae5 67 67 void checkWorkers(); 68 68 69 /** Schedules a checkalive operation for a single worker at \a address. 70 * 71 * \param address the address to check 72 */ 73 void CheckWorker(const WorkerAddress &address); 74 69 75 /** Checks busy workers in pool whether react to CheckAlive. 70 76 * … … 142 148 143 149 //!> last set of working workers 144 WorkerList_t Last WorkerList;150 WorkerList_t LastBusyWorkerList; 145 151 146 152 //!> last set of working workers 147 WorkerList_t CurrentWorkerList; 153 WorkerList_t CurrentBusyWorkerList; 154 155 //!> set of idle working workers 156 std::set<WorkerAddress> CurrentIdleWorkerList; 148 157 149 158 //!> reference to OperationQueue for pushing CheckAliveWorkerOperation -
ThirdParty/JobMarket/src/JobMarket/Pool/WorkerPool.hpp
r74d798 r2c3ae5 69 69 typedef std::vector<std::pair<std::string, std::string> > WorkerList_t; 70 70 WorkerList_t getListOfIdleWorkers() const; 71 const Pool_t& getPoolOfWorkers() const72 {73 return pool;74 }75 71 76 72 /** Return the number of busy workers.
Note:
See TracChangeset
for help on using the changeset viewer.
