- Timestamp:
- 04/05/05 10:08:24 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/daemon/togad.py
r38 r39 307 307 # 308 308 xmlthread = threading.Thread( None, self.processXML, 'xmlthread' ) 309 debug_msg( 8, self.printTime() + ' - mainthread() - xmlthread() started' )310 309 xmlthread.start() 311 310 … … 316 315 # 317 316 storethread = threading.Thread( None, self.storeMetrics, 'storethread' ) 318 debug_msg( 8, self.printTime() + ' - mainthread() - storethread() started' )319 317 storethread.start() 320 318 … … 325 323 "Store metrics retained in memory to disk" 326 324 325 debug_msg( 8, self.printTime() + ' - storethread(): started.' ) 326 327 327 # Store metrics somewhere between every 60 and 180 seconds 328 328 # 329 329 STORE_INTERVAL = random.randint( 60, 180 ) 330 330 331 debug_msg( 8, self.printTime() + ' - storethread() - storemetricthread() started: Storing data..' ) 332 333 # threaded call to: self.myHandler.storeMetrics() 334 # 335 storethread = threading.Thread( None, self.myHandler.storeMetrics(), 'storemetricthread' ) 331 storethread = threading.Thread( None, self.storeThread, 'storemetricthread' ) 336 332 storethread.start() 337 333 338 debug_msg( 8, self.printTime() + ' - storethread() -Sleeping.. (%ss)' %STORE_INTERVAL )334 debug_msg( 8, self.printTime() + ' - storethread(): Sleeping.. (%ss)' %STORE_INTERVAL ) 339 335 time.sleep( STORE_INTERVAL ) 340 debug_msg( 8, self.printTime() + ' - storethread() -Done sleeping.' )336 debug_msg( 8, self.printTime() + ' - storethread(): Done sleeping.' ) 341 337 342 338 if storethread.isAlive(): 343 339 344 debug_msg( 8, self.printTime() + ' - storethread() - storemetricthread() still running, waiting to finish..' ) 345 parsethread.join( 180 ) # Maximum time is 3 minutes for storing thread to finish - more then enough 346 347 debug_msg( 8, self.printTime() + ' - storethread() - storemetricthread() finished.' ) 348 349 debug_msg( 8, self.printTime() + ' - storethread() finished' ) 340 debug_msg( 8, self.printTime() + ' - storethread(): storemetricthread() still running, waiting to finish..' ) 341 parsethread.join( 180 ) # Maximum time is for storing thread to finish 342 debug_msg( 8, self.printTime() + ' - storethread(): Done waiting.' ) 343 344 debug_msg( 8, self.printTime() + ' - storethread(): finished.' ) 350 345 351 346 return 0 347 348 def storeThread( self ): 349 350 debug_msg( 8, self.printTime() + ' - storemetricthread(): started.' ) 351 debug_msg( 8, self.printTime() + ' - storemetricthread(): Storing data..' ) 352 ret = self.myHandler.storeMetrics() 353 debug_msg( 8, self.printTime() + ' - storemetricthread(): Done storing.' ) 354 debug_msg( 8, self.printTime() + ' - storemetricthread(): finished.' ) 355 356 return ret 352 357 353 358 def processXML( self ): 354 359 "Process XML" 355 360 356 debug_msg( 8, self.printTime() + ' - xmlthread() - parsethread() started: Parsing..' ) 357 358 # threaded call to: self.myParser.parse( self.myXMLGatherer.getFileObject() ) 359 # 360 parsethread = threading.Thread( None, self.myParser.parse, 'parsethread', [ self.myXMLGatherer.getFileObject() ] ) 361 debug_msg( 8, self.printTime() + ' - xmlthread(): started.' ) 362 363 parsethread = threading.Thread( None, self.parseThread, 'parsethread' ) 361 364 parsethread.start() 362 365 363 debug_msg( 8, self.printTime() + ' - xmlthread() -Sleeping.. (%ss)' %self.config.getLowestInterval() )366 debug_msg( 8, self.printTime() + ' - xmlthread(): Sleeping.. (%ss)' %self.config.getLowestInterval() ) 364 367 time.sleep( float( self.config.getLowestInterval() ) ) 365 debug_msg( 8, self.printTime() + ' - xmlthread() -Done sleeping.' )368 debug_msg( 8, self.printTime() + ' - xmlthread(): Done sleeping.' ) 366 369 367 370 if parsethread.isAlive(): 368 371 369 debug_msg( 8, self.printTime() + ' - xmlthread() - parsethread() still running, waiting to finish..' ) 370 parsethread.join( 180 ) # Maximum time is 3 minutes for XML thread to finish - more then enough 371 372 debug_msg( 8, self.printTime() + ' - xmlthread() - parsethread() finished.' ) 373 374 debug_msg( 8, self.printTime() + ' - xmlthread() finished.' ) 372 debug_msg( 8, self.printTime() + ' - xmlthread(): parsethread() still running, waiting to finish..' ) 373 parsethread.join( 60 ) # Maximum time for XML thread to finish 374 debug_msg( 8, self.printTime() + ' - xmlthread(): Done waiting.' ) 375 376 debug_msg( 8, self.printTime() + ' - xmlthread(): finished.' ) 375 377 376 378 return 0 379 380 def parseThread( self ): 381 382 debug_msg( 8, self.printTime() + ' - parsethread(): started.' ) 383 debug_msg( 8, self.printTime() + ' - parsethread(): Parsing XML..' ) 384 ret = self.myParser.parse( self.myXMLGatherer.getFileObject() ) 385 debug_msg( 8, self.printTime() + ' - parsethread(): Done parsing.' ) 386 debug_msg( 8, self.printTime() + ' - parsethread(): finished.' ) 387 388 return ret 377 389 378 390 class GangliaConfigParser:
Note: See TracChangeset
for help on using the changeset viewer.