Skip to content

Tag: multiprocessing

Run function in another thread

So say there are two running codes: script1 and script2. I want script2 to be able to run a function in script1. script1 will be some kind of background process that will run “forever”. The point is to be able to make an API for a background process, E.G. a server. The unclean way to do it would b…

Graceful cleanup for multiprocess pool python

I am running a multiprocessing pool, mapped over a number of inputs. My worker processes have an initialization step that spins up a connection to selenium and a database. When the pool finishes its job, what is the graceful way to close these connections rather than just relying on python’s memory mana…