python - How do I name the processes in a multiprocessing.pool? -
if create pool 4 workers , set them task (using pool.apply_async(..)
), can access name of each process within using multiprocessing.current_process().name
, how set name parent process (this logging)?
process.name
just setter, can freely assign it.
the pool takes initializer
argument. can callable, , it'll called 1 time when each subprocess starts up. can point function sets name
property of process whatever want.
python python-multiprocessing
No comments:
Post a Comment