Closed pipermerriam closed 5 years ago
You don't all have to review this but I pinged all of you because this is my proposed code for replacing multiprocessing
in Trinity and I'd like to get any feedback you might have on the API or whatever before going ahead towards a 0.1.0
release.
Cool, I just skimmed it, but nothing stood out as a big problem. I did think it was a little strange that setting the return code and error is on the public API, since I'd expect that to be handled internally.
Unrelated: I'd recommend splitting out the template filling into a separate commit. (Maybe a different PR, next time).
FYI, merged and published as 0.1.0-alpha.1
so that we can start tinkering with it.
What is this?
This implements the core of the library which are two functions.
run_in_process(async_fn, *args)
open_in_process(async_fn, *args)
These functions allow running arbitrary coroutines in isolated processes and getting their results.
These are implemented such that
SIGTERM
andSIGINT
are automatically propagated to child processes and chat child processes.A
SIGKILL
to a child process also behaves correctly with the child process reporting aProcessKilled
exception as the error.Exceptions in child processes are also properly propagated to the parent process.
Cute Animal Picture