python - mysql issue while using concurrent.futures -


my code follows.

for in self.parent_job.child_jobs:   futures.append(executor.submit(invokeruncommand, i))  future in concurrent.futures.as_completed(futures):   print("future exception: %s" %future.exception())  executor.shutdown(wait="true")  def invokeruncommand(self):     db_connect, db_cur = connect_to_database_pl()     self.setjobstatus(db_cur, job_running)     ...  def setjobstatus(self, db_cur, job_status, run_status=run_passed):      self.job_status = job_status       sql = """update jobs                  set job_status=%d                  job_id=%d""" \               %(job_status, self.job_id)      db_cur.execute(sql)  def connect_to_database_pl(dict_cursor=1):     database = sql_db      db_users = {       'employee' : {'user' : 'test',  'password' : 'test123'},     }     user = db_users[database]['user']     password = db_users[database]['password']      try:         db_cnxn = mysqldb.connect (host = sql_host,                                 user = user,                                 passwd = password,                                db = database)         if dict_cursor==0:           db_curs = db_cnxn.cursor()         else:           db_curs = db_cnxn.cursor(mysqldb.cursors.dictcursor)       except mysqldb.error, e:         print "error %d: %s" % (e.args[0], e.args[1])         sys.exit (1)     return (db_cnxn, db_curs) 

i face errors "error 2013: lost connection mysql server during query future exception: 1 segmentation fault" , "error 2006: mysql server has gone away future exception: 1"

though create connection object per future, above errors.

could me rid of error?


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -