timeview icon indicating copy to clipboard operation
timeview copied to clipboard

using subprocess and signal.sigint for processor.process()

Open lxkain opened this issue 8 years ago • 0 comments

this is just an idea, but what if call processor.process() in a separate subprocess. Should a 'cancel' signal be emitted, we can send that subprocess an interrupt signal (emulating ctrl+c) and breakup the numerical operation right there and there.

see stack overflow thread for loosely related subject material

https://stackoverflow.com/questions/13024532/simulate-ctrl-c-keyboard-interrupt-in-python-while-working-in-linux

I created a stackoverflow issue here: https://stackoverflow.com/questions/46610961/how-to-abort-numpy-operation-in-qthead-without-using-terminate?noredirect=1#comment80180069_46610961

At this point, there are two options:

abort but not attempt to stop the CPU, let the CPU keep running; which would be simple to implement. have an abort method interrupt the numpy (or general) numerical operation. For this, I would need to offload the task to another python multiprocessing thread or process, and send the interrupt signal (far more complex).

I'll implement method 1 for now (currently using QThread.terminate() which makes us susceptible to memory leaks.

We've decided to not try and reclaim any CPU time from a cancelled process; and for a version further down the line, if this becomes a major issue we should consider finding an abort method that would interrupt the CPU on the spot.

lxkain avatar Dec 12 '17 15:12 lxkain