如何使用多个进程调用?
下面的代码可以很好地处理进程= 1。
定义:
def origin_and_url_from_url(url):
ori_url = url.strip()
cursor = connection.cursor()
cursor.execute("SELECT DISTINCT url, id FROM origin where url = %s",[ori_url])
rows = cursor.fetchall()
cursor.close()
for a_row in rows:
with open('TopListwith100CardsWithID.csv','a') as file:
file.write(str(a_row[1])+ ", ")
file.write(str(a_row[0]))
file.write('\n')呼叫:
with open('SEMethodologies/TopListwith100Cards.csv', 'r') as f:
reader = csv.reader(f)
top_list = list(reader)
p = multiprocessing.Pool(1, initializer, ())
logger.info("Pool Started for ids")
results = p.starmap(origin_and_url_from_url, top_list)
print(results)
p.close()但是,如果我通过将这一行p = multiprocessing.Pool(2, initializer, ())更改为两个进程来调用,它就会显示这个错误--心理copg2.OperationalError: SSL错误:解密失败或坏记录Mac
发布于 2021-03-12 03:53:10
我有一个非常烦人的bug,听起来类似我的服务会用这个错误重新启动。
Corruption detected. Cipher functions:OPENSSL_internal:BAD_DECRYPT
routines:OPENSSL_internal:DECRYPTION_FAILED_OR_BAD_RECORD_MAC
Decryption error: TSI_DATA_CORRUPTED在Google中使用Postgres运行Gunicorn服务。最后调试了许多多处理配置、Postgres设置等。
为我修复它的是冻结grpcio python包在1.29.0,基于这的答案,其中说解密失败的错误发生在GRPCv1.3.x之后。
https://stackoverflow.com/questions/61948507
复制相似问题