Get process output from Malt, instead of capturing it ourselves#84
Get process output from Malt, instead of capturing it ourselves#84
Conversation
This enables us to get the output generated by crashes jobs.
81c7d58 to
6227e30
Compare
|
So, the remaining failures now are only due to buffering: the tests at ParallelTestRunner.jl/test/runtests.jl Lines 236 to 238 in 608f947 ParallelTestRunner.jl/test/runtests.jl Lines 248 to 251 in 608f947 print-like function, without a newline which would flush the stream.
Unless someone knows a magic way to run julia unbuffered like |
|
@vchuravy @maleadt with the caveat that we need to wait for the upstream PR JuliaPluto/Malt.jl#103, I'd appreciate some feedback about the design of this PR and its tradeoffs. |
83db39f to
ca5c3ae
Compare
ca5c3ae to
02219b7
Compare
|
This is now ready for review! |
src/ParallelTestRunner.jl
Outdated
|
|
||
| # Adapted from `Malt._stdio_loop` | ||
| function stdio_loop(worker::PTRWorker) | ||
| @async while !eof(worker.w.stdout) && Malt.isrunning(worker) |
There was a problem hiding this comment.
Obligatory: Why @async and not @spawn
There was a problem hiding this comment.
No specific reason, I had followed the original Malt._stdio_loop. I pushed a change to replace @async -> Threads.@spawn
src/ParallelTestRunner.jl
Outdated
| wrkr = Malt.Worker(; exename, exeflags, env) | ||
| WORKER_IDS[wrkr.proc_pid] = length(WORKER_IDS) + 1 | ||
| io = IOBuffer() | ||
| wrkr = PTRWorker(Malt.Worker(; exename, exeflags, env, monitor_stdout=false, monitor_stderr=false), io) |
There was a problem hiding this comment.
Can we fold this into the constructor?
There was a problem hiding this comment.
Done! Also included the worker id as a field of the worker (with a global atomic counter), no need to keep a dictionary around for doing the mapping.
src/ParallelTestRunner.jl
Outdated
| break | ||
| end | ||
| end | ||
| @async while !eof(worker.w.stderr) && Malt.isrunning(worker) |
There was a problem hiding this comment.
Slight order weirdness... What happens if Malt.isrunning is true before we have consumed all the text?
There was a problem hiding this comment.
Uhm, to this one I don't have a good answer
|
It's so nice to be able to see the output of a segfault 🥳 |
Note: still needs tests (can adapt the example above).Tests addedRequires JuliaPluto/Malt.jl#103. Fix #83.