Changeset 176 for trunk/daemon
- Timestamp:
- 08/01/05 15:46:06 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/daemon/togad.py
r175 r176 10 10 import os.path 11 11 import time 12 import thread 12 13 import threading 13 14 import random … … 381 382 self.myXMLSource = self.myXMLGatherer.getFileObject() 382 383 debug_msg( 1, 'torque_xml_thread(): Parsing..' ) 383 xml.sax.parse( self.myXMLSource, self.myXMLHandler, self.myXMLError ) 384 385 try: 386 xml.sax.parse( self.myXMLSource, self.myXMLHandler, self.myXMLError ) 387 except socket.error, msg: 388 debug_msg( 0, 'ERROR: Socket error in connect to datasource!: %s' %msg ) 389 384 390 debug_msg( 1, 'torque_xml_thread(): Done parsing.' ) 385 391 debug_msg( 1, 'torque_xml_thread(): Sleeping.. (%ss)' %(str( self.config.getLowestInterval() ) ) ) … … 761 767 xml_thread = threading.Thread( None, self.processXML, 'xml_thread' ) 762 768 xml_thread.start() 763 except error, msg:769 except thread.error, msg: 764 770 debug_msg( 0, 'ERROR: Unable to start xml_thread!: '+str(msg)) 765 771 #return 1 … … 773 779 store_thread = threading.Thread( None, self.storeMetrics, 'store_thread' ) 774 780 store_thread.start() 775 except error, msg:781 except thread.error, msg: 776 782 debug_msg( 0, 'ERROR: Unable to start store_thread!: '+str(msg)) 777 783 #return 1 … … 790 796 store_metric_thread = threading.Thread( None, self.storeThread, 'store_metric_thread' ) 791 797 store_metric_thread.start() 792 except error, msg:798 except thread.error, msg: 793 799 debug_msg( 0, 'ERROR: Unable to start ganglia_store_thread()!: '+str(msg) ) 794 800 return 1 … … 816 822 debug_msg( 1, 'ganglia_store_metric_thread(): Storing data..' ) 817 823 ret = self.myXMLHandler.storeMetrics() 824 if ret > 0: 825 debug_msg( 0, 'ganglia_store_metric_thread(): UNKNOWN ERROR %s while storing Metrics!' %str(ret) ) 818 826 debug_msg( 1, 'ganglia_store_metric_thread(): Done storing.' ) 819 827 debug_msg( 1, 'ganglia_store_metric_thread(): finished.' ) 820 828 821 return ret829 return 0 822 830 823 831 def processXML( self ): … … 827 835 parsethread = threading.Thread( None, self.parseThread, 'parsethread' ) 828 836 parsethread.start() 829 except error, msg:837 except thread.error, msg: 830 838 debug_msg( 0, 'ERROR: Unable to start ganglia_xml_thread()!: ' + str(msg) ) 831 839 return 1 … … 853 861 debug_msg( 1, 'ganglia_parse_thread(): Parsing XML..' ) 854 862 self.myXMLSource = self.myXMLGatherer.getFileObject() 855 ret = xml.sax.parse( self.myXMLSource, self.myXMLHandler, self.myXMLError ) 863 864 try: 865 xml.sax.parse( self.myXMLSource, self.myXMLHandler, self.myXMLError ) 866 except socket.error, msg: 867 debug_msg( 0, 'ERROR: Socket error in connect to datasource!: %s' %msg ) 868 856 869 debug_msg( 1, 'ganglia_parse_thread(): Done parsing.' ) 857 870 debug_msg( 1, 'ganglia_parse_thread(): finished.' ) 858 871 859 return ret872 return 0 860 873 861 874 class GangliaConfigParser: … … 1115 1128 1116 1129 if len( self.myMetrics[ hostname ][ metricname ] ) > 0: 1117 metrics_to_store.append( self.myMetrics[ hostname ][ metricname ].pop( 0 ) ) 1130 1131 try: 1132 metrics_to_store.append( self.myMetrics[ hostname ][ metricname ].pop( 0 ) ) 1133 except IndexError, msg: 1134 1135 pass 1118 1136 1119 1137 self.slot.release() … … 1353 1371 ganglia_xml_thread.start() 1354 1372 1355 except error, msg:1373 except thread.error, msg: 1356 1374 debug_msg( 0, 'FATAL ERROR: Unable to start main threads!: '+ str(msg) ) 1357 1375 syslog.closelog()
Note: See TracChangeset
for help on using the changeset viewer.