def process_runtask_oracle(hosttag, sqltext, mytask, useraccount, ipaddr): flag = (1 if mytask.backup_status == 1 else 3) # db_type_record = func.get_dbtype_bydbtag(hosttag) # dbtype_flag = str(db_type_record[0][0]) # if dbtype_flag == 'mysql': # results, col, tar_dbname = incept.inception_check(hosttag, sqltext, flag) # incept.make_sure_mysql_usable() # elif dbtype_flag == 'Oracle': # results, col, tar_dbname = incept_oracle_run(hosttag,sqltext,useraccount,ipaddr) #incept.make_sure_mysql_usable() results, col, tar_dbname = incept_oracle_run(hosttag, sqltext, useraccount, ipaddr) status = 'executed' c_time = mytask.create_time mytask.update_time = datetime.datetime.now() if flag == 1: mytask.backup_status = 2 mytask.save() for row in results: try: inclog = Incep_error_log(myid=row[0],stage=row[1],errlevel=row[2],stagestatus=row[3],errormessage=row[4],\ sqltext=row[5],affectrow=row[6],sequence=row[7],backup_db=row[8],execute_time=row[9],sqlsha=row[10],\ create_time=c_time,finish_time=mytask.update_time) inclog.save() #if some error occured in inception_check stage except Exception, e: inclog = Incep_error_log(myid=999,stage='',errlevel=999,stagestatus='',errormessage=row[0],\ sqltext=e,affectrow=999,sequence='',backup_db='',execute_time='',sqlsha='',\ create_time=c_time,finish_time=mytask.update_time) inclog.save() if (int(row[2]) != 0): status = 'executed failed'
def process_runtask(hosttag, sqltext, mytask): results, col, tar_dbname = incept.inception_check(hosttag, sqltext, 1) status = 'executed' c_time = mytask.create_time mytask.update_time = datetime.datetime.now() mytask.save() for row in results: try: inclog = Incep_error_log(myid=row[0],stage=row[1],errlevel=row[2],stagestatus=row[3],errormessage=row[4],\ sqltext=row[5],affectrow=row[6],sequence=row[7],backup_db=row[8],execute_time=row[9],sqlsha=row[10],\ create_time=c_time,finish_time=mytask.update_time) inclog.save() #if some error occured in inception_check stage except Exception, e: inclog = Incep_error_log(myid=999,stage='',errlevel=999,stagestatus='',errormessage=row[0],\ sqltext=e,affectrow=999,sequence='',backup_db='',execute_time='',sqlsha='',\ create_time=c_time,finish_time=mytask.update_time) inclog.save() if (int(row[2]) != 0): status = 'executed failed'
def process_runtask(hosttag,sqltext,mytask): results,col,tar_dbname = incept.inception_check(hosttag,sqltext,1) status='executed' c_time = mytask.create_time mytask.update_time = datetime.datetime.now() mytask.save() for row in results: try: inclog = Incep_error_log(myid=row[0],stage=row[1],errlevel=row[2],stagestatus=row[3],errormessage=row[4],\ sqltext=row[5],affectrow=row[6],sequence=row[7],backup_db=row[8],execute_time=row[9],sqlsha=row[10],\ create_time=c_time,finish_time=mytask.update_time) inclog.save() #if some error occured in inception_check stage except Exception,e: inclog = Incep_error_log(myid=999,stage='',errlevel=999,stagestatus='',errormessage=row[0],\ sqltext=e,affectrow=999,sequence='',backup_db='',execute_time='',sqlsha='',\ create_time=c_time,finish_time=mytask.update_time) inclog.save() if (int(row[2])!=0): status='executed failed'