gcv / julia-snail

An Emacs development environment for Julia
GNU General Public License v3.0
231 stars 21 forks source link

Allow interrupting long-running Julia tasks #104

Closed gcv closed 4 months ago

gcv commented 1 year ago

Right now, a computation kicked off using any of the julia-snail-send-* commands cannot be interrupted.

MasonProtter commented 1 year ago

I think the solution to this is just having an interrupt function which does Base.throwto(julia_snail_task, InterruptException()). Does julia-snail already have a separate task it uses for evaluation?

gcv commented 1 year ago

Nope, no separate tasks for evaluation. :( I agree that's a good approach.

MasonProtter commented 1 year ago

Probably what you should do is launch the computation in a task, and then have another task that checks every n miliseconds if the task is completed, and if it is completed you fetch it.

You can then stick a hook into that secondary task that does the interruption when requested.

gcv commented 11 months ago

This is fixed in a88755d. Or so I hope! Snail now runs evaluations sent on its wire protocol in separate Julia tasks, and they're tracked and interruptible using M-x julia-snail-interrupt-task. The change will be in MELPA in a couple of hours. Feedback and bug reports welcome.