Changeset 5932
- Timestamp:
- Sep 26, 2017, 1:42:45 PM (2 years ago)
- Location:
- lliurex-analytics-server/trunk/fuentes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lliurex-analytics-server/trunk/fuentes/debian/changelog
r5926 r5932 1 lliurex-analytics-server (0.2.2) xenial; urgency=medium 2 3 * Fixed initialization 4 5 -- M.Angel Juan <m.angel.juan@gmail.com> Tue, 26 Sep 2017 12:37:00 +0200 6 1 7 lliurex-analytics-server (0.2.1) xenial; urgency=medium 2 8 -
lliurex-analytics-server/trunk/fuentes/lliurex-analytics-server/usr/sbin/analyticsd
r5926 r5932 150 150 def __init__(self,mon,t='main'): 151 151 self.t=t 152 self.reconnect=1 152 153 self.empty = False 153 154 self.conn=None … … 448 449 449 450 def worker(self): 451 printea("Starting worker {} processing".format(self.t),'info') 450 452 while not (self.mon.terminate and self.empty): 451 453 if self.mon.paused or self.empty: … … 461 463 else: 462 464 try: 463 self.conn.begin() 465 if self.conn == None: 466 raise Exception('Connection not available, probably it\'s a first run') 467 else: 468 self.conn.begin() 464 469 if self.process(): 465 470 self.conn.commit() … … 470 475 except Exception as e: 471 476 try: 472 self.conn.rollback() 477 if self.conn != None: 478 self.conn.rollback() 473 479 except: 474 480 printea("Can't rollback last actions",'info') 475 481 pass 476 482 if e[0] != 2006: 477 printea("Exception processing: {}".format(e)) 483 printea("Exception processing worker({}): {}".format(self.t,e)) 484 if e[0] == 2006: # SERVER GONE AWAY 485 printea("Worker ({}) detected server gone away !!!: {}".format(self.t,e)) 486 printea("Trying to recover connection ({})".format(self.t)) 487 if self.reconnect == 100: 488 printea("Worker ({}) says: lost connection to database, reconnection not possible, terminating all processes".format(self.t)) 489 self.mon.term() 478 490 else: 479 if self.reconnect == 100: 480 printea("Lost connection to database") 481 self.mon.term() 482 else: 483 self.reconnect+=1 484 printea('Reconnect to mysql({}) sleeping({})'.format(self.reconnect,self.reconnect*self.reconnect)) 485 time.sleep(self.reconnect*self.reconnect) 486 try: 487 self.init_db() 488 except: 489 printea('Unable to initialize worker {}'.format(self.t)) 490 pass 491 self.reconnect+=1 492 printea('Reconnect({}) to mysql sleeping({})'.format(self.reconnect,self.reconnect*self.reconnect)) 493 time.sleep(self.reconnect*self.reconnect) 494 try: 495 self.init_db() 496 printea("Recovered worker {} connection".format(self.t),'info') 497 except: 498 printea('Unable to initialize worker {}'.format(self.t)) 499 pass 491 500 492 501 … … 515 524 for x in THREADS: 516 525 self.db[x] = DB(self,x) 517 try:518 self.db[x].init_db()519 except Exception as e:520 printea('Error initializing database connections: {}'.format(str(e)))521 sys.exit(1)526 #try: 527 # self.db[x].init_db() 528 #except Exception as e: 529 # printea('Error initializing database connections: {}'.format(str(e))) 530 # sys.exit(1) 522 531 printea("Monitor initialized with {} threads".format(len(THREADS)),'info') 523 532
Note: See TracChangeset
for help on using the changeset viewer.