Closed jrandall closed 9 years ago
Hi Josh,
Thanks for this. I'm not working on the Platypus code right now, so I'm forwarding this to Dan at WTCHG.
Kind regards, Andy
On Wed, Jun 24, 2015 at 5:32 PM, Joshua C. Randall <notifications@github.com
wrote:
While performing variant calling, Platypus ignores all KeyboardInterrupts (cython prints Exception KeyboardInterrupt: ... ignored messages). This is because runner transfers control of the main thread to the variant calling cython code, which does not run PyErr_CheckSignals().
Rather than adding signal handling to the cython side of things, I've addressed this in this PR by keeping the main thread python interpreter alive (sleeping for 1 second at a time until all subprocesses are done) and handling any KeyboardExceptions that interrupt that sleep.
In order to make this work for nCPU=1, I've needed to eliminate the special case for that such that a separate processing thread is spawned for the variant caller when nCPU=1 (so technically this means that even with nCPU=1, Platypus would have two processes but one of them would only be performing a few of operations per second). If that is not acceptable, then it might be possible to add another special case to the single process
cython such that it implements the signal handlers.
You can view, comment on, or merge this pull request online at:
https://github.com/andyrimmer/Platypus/pull/40 Commit Summary
- Changes all bare
except:
statements toexcept Exception:
- Fixes Platypus so that it can be killed by a KeyboardInterrupt
File Changes
- M extensions/DeNovo/bayesianDeNovoFilter.py https://github.com/andyrimmer/Platypus/pull/40/files#diff-0 (4)
- M scripts/binIndelRatioByHP.py https://github.com/andyrimmer/Platypus/pull/40/files#diff-1 (2)
- M scripts/binIndelRatioByPal.py https://github.com/andyrimmer/Platypus/pull/40/files#diff-2 (2)
- M scripts/binTsTvByHP.py https://github.com/andyrimmer/Platypus/pull/40/files#diff-3 (2)
- M scripts/binTsTvByPal.py https://github.com/andyrimmer/Platypus/pull/40/files#diff-4 (2)
- M scripts/computeIndelRatio.py https://github.com/andyrimmer/Platypus/pull/40/files#diff-5 (2)
- M scripts/computeTsTv.py https://github.com/andyrimmer/Platypus/pull/40/files#diff-6 (2)
- M scripts/countRefAndNonRefChars.py https://github.com/andyrimmer/Platypus/pull/40/files#diff-7 (2)
- M scripts/filterGOF.py https://github.com/andyrimmer/Platypus/pull/40/files#diff-8 (2)
- M scripts/filterHP.py https://github.com/andyrimmer/Platypus/pull/40/files#diff-9 (2)
- M scripts/filterPal.py https://github.com/andyrimmer/Platypus/pull/40/files#diff-10 (2)
- M scripts/filterTU.py https://github.com/andyrimmer/Platypus/pull/40/files#diff-11 (2)
- M scripts/filterTotCoverage.py https://github.com/andyrimmer/Platypus/pull/40/files#diff-12 (2)
- M scripts/filterVarCoverage.py https://github.com/andyrimmer/Platypus/pull/40/files#diff-13 (2)
- M scripts/filterVarFreq.py https://github.com/andyrimmer/Platypus/pull/40/files#diff-14 (2)
- M scripts/keepGof.py https://github.com/andyrimmer/Platypus/pull/40/files#diff-15 (2)
- M scripts/removeHomopolymers.py https://github.com/andyrimmer/Platypus/pull/40/files#diff-16 (2)
- M scripts/removeTandems.py https://github.com/andyrimmer/Platypus/pull/40/files#diff-17 (2)
- M scripts/removeTandemsAndHPs.py https://github.com/andyrimmer/Platypus/pull/40/files#diff-18 (2)
- M src/cython/cpopulation.pyx https://github.com/andyrimmer/Platypus/pull/40/files#diff-19 (2)
- M src/cython/fastafile.pyx https://github.com/andyrimmer/Platypus/pull/40/files#diff-20 (2)
- M src/cython/platypusutils.pyx https://github.com/andyrimmer/Platypus/pull/40/files#diff-21 (6)
- M src/cython/variant.h https://github.com/andyrimmer/Platypus/pull/40/files#diff-22 (4)
- M src/python/indelerrormodel.py https://github.com/andyrimmer/Platypus/pull/40/files#diff-23 (4)
- M src/python/lowcov.py https://github.com/andyrimmer/Platypus/pull/40/files#diff-24 (6)
- M src/python/runner.py https://github.com/andyrimmer/Platypus/pull/40/files#diff-25 (98)
- M src/python/vcf.py https://github.com/andyrimmer/Platypus/pull/40/files#diff-26 (12)
Patch Links:
- https://github.com/andyrimmer/Platypus/pull/40.patch
- https://github.com/andyrimmer/Platypus/pull/40.diff
— Reply to this email directly or view it on GitHub https://github.com/andyrimmer/Platypus/pull/40.
This email is sent on behalf of Genomics plc, a public limited company registered in England and Wales with registered number 8839972, VAT registered number 189 2635 65 and registered office at 24 Cornhill, London, EC3V 3ND, United Kingdom. The contents of this e-mail and any attachments are confidential to the intended recipient. If you are not the intended recipient please do not use or publish its contents, contact Genomics plc immediately at info@genomicsplc.com info@genomicsltd.com then delete. You may not copy, forward, use or disclose the contents of this email to anybody else if you are not the intended recipient. Emails are not secure and may contain viruses.
?
Thanks Josh. Merged. I'll try to get this into the release version asap.
Best Dan
While performing variant calling, Platypus ignores all KeyboardInterrupts (cython prints
Exception KeyboardInterrupt: ... ignored
messages). This is because runner transfers control of the main thread to the variant calling cython code, which does not runPyErr_CheckSignals()
.Rather than adding signal handling to the cython side of things, I've addressed this in this PR by keeping the main thread python interpreter alive (sleeping for 1 second at a time until all subprocesses are done) and handling any KeyboardExceptions that interrupt that sleep.
In order to make this work for
nCPU=1
, I've needed to eliminate the special case for that such that a separate processing thread is spawned for the variant caller when nCPU=1 (so technically this means that even with nCPU=1, Platypus would have two processes but one of them would only be performing a few of operations per second). If that is not acceptable, then it might be possible to add another special case to the single process cython such that it implements the signal handlers.