Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
Closed as not planned
Description
Bug report
Bug description:
Q:
Run the following code, sometimes subprogres that is created by [class A's Pool or class B's Pool] is going to sleeping status, and there is not any error log output.
But code(#3 or #4)run success, code(#1 or #2) is not run,The reason is pool.close() and pool.join() is not writed in source code?
test.pyfrommultiprocessingimportPoolimportosfromtest_commonimport*classTest: def__init__(self): self.A=A() self.B=B() defrun(self): data_list=list(range(10001, 11984)) a_list=self.A.run(data_list) print("self.A.run end") #1new_list=self.B.run(data_list, a_list) print("self.B.run end") #2defmain(): run_module=Test() run_module.run() if__name__=='__main__': main() ---------------------------------------------test_common.pyimportosimportmultiprocessingfrommultiprocessingimportPoolimportioimportdatetimeimporttimeclassA: def__init__(self): passdefrun(self, data_list): a_list= [] foritemindata_list: file_path="{}/{}.aaa".format("/tmp/aaa", item) a_list.append(file_path) pool_size=1pool=Pool(pool_size) pool.map(methodA, a_list) print("A#run end") #3returna_listdefmethodA(file_path): ifos.path.isfile(file_path): return# other codeclassB: def__init__(self): passdefrun(self, data_list, a_list): b_list= [] foritemindata_list: b_path="{}/{}.bbb".format("/tmp/bbb", item) b_list.append(b_path) pool_size=1pool=Pool(pool_size) pool.map(methodB, b_list) print("B#run end") #4returnb_listdefmethodB(b_path): ifos.path.isfile(b_path): return# other codeCPython versions tested on:
3.10
Operating systems tested on:
Linux
Metadata
Metadata
Assignees
Labels
No labels