python futures.as_completed在出现错误后停止响应



我有一些使用期货的代码,这些代码正在工作并提供输出,直到我命中并出错,然后输出停止。其余的进程继续执行(我可以看到它们在数据库中运行(,我只是无法捕捉结果。我错过了什么?

from concurrent import futures
import oracle_manager
import os
sql_statements=['select count(*) from PS_SCC_NTF_PREF',
'select count(*) from PS_SCC_STN_LTR_TBL',
'select count(*) from PS_SCC_TM_TRAN_AGR',
'select count(*) from PS_SCRTY_TBL_INST',
'select count(*) from PS_SCTN_CMBND',
'select count(*) from PS_SCTN_CMBND_TBL',
'select count(*) from PS_SEC_ITEM_CLS',
'select count(*) from PS_SESSION_TBL',
...]
def run_sql(sql):
temp_connection = oracle_manager.OracleConnection(un, pw, tns)
value = temp_connection.execute_count(sql)
return (value, os.getpid())
worker_pool = futures.ProcessPoolExecutor(5)
wait_for = [worker_pool.submit(run_sql, sql_statement) for sql_statement in sql_statements] 
for f in futures.as_completed(wait_for):
try:
print(f.result())
except Exception as e:
print(e)
((1069,), 23010)
((130464,), 23013)
((40220,), 23012)
((296372,), 23009)
((930954,), 23011)
((13836,), 23012)
((19707,), 23009)
((52130,), 23010)
((130707,), 23013)
((21,), 23011)
((276,), 23009)
((53157,), 23012)
((111,), 23009)
((381,), 23009)
An exception occurred running the following sql statement: "select count(*) from PS_SF_ACCTG_LN"
Oracle-Error-Code/Message: 600  ORA-00600: internal error code, arguments: [kskqgetserviceid:nosvcidpdb1], [3], [0], [], [], [], [], [], [], [], [], []

谢谢你的帮助!

UGH。在仔细检查了我的oracle_manager之后,我发现在进行调试时,我在execute_count方法的try/except块中放置了一个exit(1(。删除出口解决了问题。

相关内容

  • 没有找到相关文章

最新更新