New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add keyboard interrupt handling into cython files (particular those that run long) #9136
Comments
maybe T-sne is also a candidate? I haven't checked. For tree-based methods I feel like it is less of an issue, since each single tree is reasonably fast usually, and after each tree we go back into Python IIRC. |
t-SNE is not a problem because while the gradient calls are written in Cython, the main gradient descent loop is written in Python. A single gradient call takes less than 10s on MNIST scale data IIRC so ctrl-c is reactive enough. More generally we could just acquire the GIL and call a dummy python callback at the end of each large iteration of C / C++ / Cython estimator loops to give Python an opportunity to raise the |
If it's only svc we probably don't want to call into python there, right? |
Also run into this with |
It would be great to add this for the tree-based methods as well. E.g., calling DBSCAN with a custom/non-sklearn distance function can take quite a while for a larger dataset and it seems to be because of the BallTree... |
At PyParis @ogrisel and me and some others thought that using cysignals to catch keyboard interrupts would be cool. Unfortunately it's LGPL. But it's not that hard to do that ourselves:
https://stackoverflow.com/questions/16769870/cython-python-and-keyboardinterrupt-ignored
We "only" need to periodically check for it.
The main use-case for this for me is that I ran some line in Jupyter and then realized i did something wrong but it takes 5h to complete. Or it runs longer than I anticipated and I want to stop it earlier.
Right now I think I need to kill the kernel, but that might even still have the process running in the background eating ram and CPU, I'm not sure.
For me this was mostly an issue with liblinear and libsvm so far. Not sure where else.
The text was updated successfully, but these errors were encountered: