0
我正在開發一個自動化框架,用於我們在我的團隊中進行的一些測試。我們所遇到的這個錯誤酸洗和做一些研究之後,我遇到了一些解決方案,並回顧了伴隨GitHub的頁面:Pathos多處理酸洗問題
- Python multiprocessing pickling error
- Multiprocessing: How to use Pool.map on a function defined in a class?
- Pickling issue with python pathos < ---從這個鏈接,我確認代碼引用了正確的庫。
- https://github.com/uqfoundation/pathos
我安裝的悲愴,我相信我正確實施了,但我仍然得到了酸洗錯誤。以下是示例代碼和回溯:
import multiprocess
collect_host = 'test_host'
collect_name = 'test_collect'
username = 'user'
start_func = test_start_callback(perf_collect=collect_name,
perf_user=username,
perf_host=collect_host,
password= password)
dpool = multiprocess.Pool(1)
args = ('', '')
worker_results = []
worker = dpool.apply_async(start_func, args)
worker_results.append(worker)
dpool.close()
dpool.join()
for result in worker_results:
result.wait()
r = result.get()
assert r, 'No results returned'
test_start_callback是一個工廠函數,用於生成不帶任何參數的函數。我編輯了未使用的代碼段。
def test_start_callback(dim_collect_host=None, dim_collect_user=None,
perf_host=None, perf_user=None, perf_collect=None,
password=None, tpcc_filename=None):
if perf_host and perf_user and perf_collect:
def perf_test_start():
from <internal> import PerfmonManager
perf = PerfmonManager(host=perf_host,
username=perf_user,
password=password,
collect_name=perf_collect)
perf.start_collect()
return perf_test_start
我缺少的是,在其他未提及的SO鏈接或者是我通過這個功能不悲愴或者支持的方式。