Skip to content
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

Salvaging an IPython session from a frozen Atom #57

Closed
tscholak opened this issue Jun 11, 2015 · 5 comments
Closed

Salvaging an IPython session from a frozen Atom #57

tscholak opened this issue Jun 11, 2015 · 5 comments

Comments

@tscholak
Copy link

Is there any way I can salvage a still running python backend if Atom locked up completely (but hasn't crashed)? Can I connect the python session to a CLI somehow?

I have been running a program for a while now and I don't want to loose my results.

@willwhitney
Copy link
Collaborator

The IPython kernel saves out a file for reconnection — if it's still running, I think you can reconnect to it. When you run a kernel directly, it spits out a message like this:

To connect another client to this kernel, use:
    --existing kernel-15035.json

The file is (for me) saved in /Users/will/.ipython/profile_default/security and is called kernel-XXXXX.json. If you find the most recent one of those in the folder, then you can run ipython console --existing kernel-15035.json to connect to it.

@willwhitney
Copy link
Collaborator

I just tried this with a kernel started by Hydrogen and it worked. You can even run %history to get the list of recently-run commands.

@tscholak
Copy link
Author

That is interesting. I just gave that a try. It seems I can connect,

$ ipython console --existing kernel-59784.json
IPython Console 3.1.0

but I don't get further than that. Maybe I should say that the python script is still running. I want to interrupt it, pickle as much as I can, and then restart atom.

@willwhitney
Copy link
Collaborator

Maybe you can send an interrupt to the kernel manually — you can ps aux | grep python, then (double-check this) kill -2 <process number>.

@tscholak
Copy link
Author

Success! Thanks a lot!
Hope that will help others, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants