好友
阅读权限20
听众
最后登录1970-1-1
|
python 写的一个多线程循环程序,pycharm运行了1个小时自己退出了,最后显示这个。哪位大神知道咋回事吗
process finished with exit code -336589910
from db_conf.db_template import OracleTemplate
import datetime
import threadpool
import time
def date_to_data(batch_num):
start_date = datetime.datetime.now()
print(start_date)
ora_conn=OracleTemplate("NEWORA_MMY")
day_num_sql = "select /*+parallel(30)*/ trunc(add_months(sysdate,-12),'Y')-min(a.create_date) srv_table_day,to_char(min(a.create_date),'yyyy-mm-dd') min_create_date" \
" from srv.diag_result a where a.create_date<trunc(add_months(sysdate,-12),'Y') and mod(DIAG_RESULT_ID,20)=%s"%(batch_num)
ora_conn.execute(day_num_sql)
day_num=ora_conn.fetchall(True)
print(day_num)
int_srv_table_day=int(day_num[0]['SRV_TABLE_DAY'])
print(int_srv_table_day)
min_table_day=day_num[0]['MIN_CREATE_DATE']
print(min_table_day)
for c1 in range(0,359):
print(c1)
for c2 in range(0,24):
srv_date_sql=" insert /*nologging */ into mid_diag_result select /*+parallel(30)*/ 'DIAG_RESULT',DIAG_RESULT_ID,'','','','20220114','待归档' from srv.diag_result where create_date>=to_date('%s %s:00:01','yyyy-mm-dd hh24:mi:ss')+%s and " \
" create_date<=to_date('%s %s:59:59','yyyy-mm-dd hh24:mi:ss')+%s and mod(DIAG_RESULT_ID,20)=%s"%(min_table_day,c2,c1,min_table_day,c2,c1,batch_num)
#print(srv_date_sql)
ora_conn.execute(srv_date_sql)
if c1 % 10 == 0:
ora_conn.commit()
print('10 over!')
ora_conn.commit()
ora_conn.close()
end_date = datetime.datetime.now()
print(end_date)
print(end_date - start_date)
print('over data~~~')
time.sleep(2)
#date_to_data()
name_list =['0','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19']
start_time = time.time()
pool = threadpool.ThreadPool(3)
requests = threadpool.makeRequests(date_to_data, name_list)
[pool.putRequest(req) for req in requests]
pool.wait()
print('%d second'%(time.time()-start_time)) |
|
发帖前要善用【论坛搜索】功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。 |
|
|
|
|