tdaff / remote_ikernel

All your Jupyter kernels, on all your machines, in one place.
https://pypi.org/project/remote_ikernel/
BSD 2-Clause "Simplified" License
17 stars 14 forks source link

Keyboard interrupt doesn't work #24

Closed tdaff closed 7 years ago

tdaff commented 7 years ago

Original report by Dmitriy Serdyuk (Bitbucket: serdyuk_dmitriy, ).


Interrupt signal is never sent. Seems that capitalizing 'c' in self.connection.sendcontrol('C') solves the problem.

tdaff commented 7 years ago

Original comment by Tom Daff (Bitbucket: tdaff, GitHub: tdaff).


Thanks for the bug report!

Unfortunately, I think that capitalising c doesn't change anything as the first thing sendcontrol does is char = char.lower(); In fact both versions of sendcontrol and even sendintr just end up sending the byte \x03 to the process, so it is the same thing in the end (although I will change to sendintr as it is slightly clearer).

Do you have something which can reproducibly not be interrupted? I've found that some things cannot be interrupted, even outside of remote kernels. Something like 10**20000000000 will not stop even if SIGINT is sent directly to the kernel process.

tdaff commented 7 years ago

Original comment by Dmitriy Serdyuk (Bitbucket: serdyuk_dmitriy, ).


I am trying to interrupt a cell with the following piece of code:

import time
i = 0
while True:
    time.sleep(1)
    print(i)
    i += 1

So, it should be possible to interrupt it. I run it through a tunnel and slurm.

tdaff commented 7 years ago

Original comment by Tom Daff (Bitbucket: tdaff, GitHub: tdaff).


Ah, looks like slurm is eating the interrupt. Adding --pty to srun_cmd allows the signal to pass for me. Could you check if it helps in your case?

tdaff commented 7 years ago

Original comment by Dmitriy Serdyuk (Bitbucket: serdyuk_dmitriy, ).


Indeed, it solves the problem.

Thanks for a great library!

tdaff commented 7 years ago

Original comment by Tom Daff (Bitbucket: tdaff, GitHub: tdaff).


Connect to slurm with pty

Allows SIGINT to pass to the kernel; fixes #23

Also enabled debugging output on all spawned connections.