-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactoring : removed explicits os.fork()
, exceptions are propagated from child process to parent
#1228
refactoring : removed explicits os.fork()
, exceptions are propagated from child process to parent
#1228
Conversation
os.fork()
, exceptions are propagated from child process to parentos.fork()
, exceptions are propagated from child process to parent
os.fork()
, exceptions are propagated from child process to parentos.fork()
, exceptions are propagated from child process to parent
Ready to be reviewed and tested |
@tgamblin |
@tgamblin I got the point failing spuriously here : I'll write a fix a ping you when done. |
@tgamblin Done : now it should be 99,9% safe 😄 |
@tgamblin I pushed some cosmetic changes to this in #1186 , let me know if you want them ported here |
@tgamblin Will check with my co-worker who uses Windows (he was the original reason for the request) and get back to you |
@goxberry: I looked into this. There are a couple more things that probably need to happen:
|
…ing/removed_explicit_fork Conflicts: lib/spack/spack/package.py
Closing as it will be difficult to maintain this alongside #1186 |
If it were merged would it be easy or is it a fundamental incompatibility? |
@tgamblin No fundamental incompatibility : all the features here are also in #1186 except that maintaining both will create conflicts (due to synchronization with In the end I think it will be easier to re-create something like #1228 if you need just that rather than continue with this PR. |
@alalazo: ok -- sounds good. Sorry for being slow! |
@tgamblin No worries. I closed it as leaving as it was was just adding noise to the list of PRs |
Modifications
os.fork()
in favor ofmultiprocessing.Process
log_output
logic has been modified and does not require calls tosys.settrace
anymorePackage.do_install.build_process
and the exceptions are propagated to parent processChanges in
log_ouput
In
develop
:__enter__
the parent process forks , set his frame explicitly to avoid executing twice the same code (quite fragile to re-positioning of thewith
statement) , reads from a pipe and writes to file__enter__
the child does the necessary to write to a pipe and then returns for executionIn the PR:
acquire
method and is set to read from the piperelease
methodNotes
In #1186 I wanted to be able to forward exceptions to parent to have a neater workflow in
do_install
. As I saw a couple ofTODOs
referring to the same issue, I extracted this PR. This has also the great advantage of not tweaking withsys.settrace
and frames (which is a major pain for the debugger sometimes).