Biostrings
Biostrings copied to clipboard
Introduce checks for R interrupts in the C code?
Would it be possible to introduce checks for R in the C code? I would like to be able to use some of these functions with R.utils::withTimeout(), but the C code ignores attempts to interrupt it by the user. I think that https://rdrr.io/github/HenrikBengtsson/RNativeAPI/man/R_CheckUserInterrupt.html might be applicable for this.
Definitely possible. However this is not necessarily as straightforward as it might sound, especially with complicated C code that involves allocating a number of resources. After a user interrupt the code needs to make sure to release all currently allocated resources before returning to R. How to handle this exactly will depend on each situation. Are there any particular functions in Biostrings that you are interested in?
Unfortunately Biostrings has received little attention in the last 5 years because of other priorities and lack of resources. Would you be willing to submit a PR? (Would need to be for one function that you choose, as a start, before going after more functions.)
H.
I will try to work on it. The function I care about is findPalindromes(), I will see if I can get it working with that.
I believe I have this working, but I am not certain that there aren't resources being allocated that I can't see. I have submitted a pull request.
Okay, there ARE resources being allocated, and I don't have enough knowledge of C to know how to handle them. I'm going to delete that pull request.
Just checking on the status of this issue--is this still functionality you need? I'll also note that R interrupts are still processed when C code finishes execution, so you should be able to use any C functions with withTimeout
as long as the time limit isn't a hard stop time and the Biostrings functions aren't running very slowly. I'd imagine for most use-cases you can have functions timeout within a minute or two of the requested time, but I'm not sure how long it takes findPalindromes
to run on your machine.
I'm no longer working on that project, so I suppose I don't need it.
sounds good, in that case I'll close it for now. Feel free to reopen if you experience more issues like this.