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

Locked src_block cells after running dead python sessions #538

Open
fraricci opened this issue May 23, 2024 · 5 comments
Open

Locked src_block cells after running dead python sessions #538

fraricci opened this issue May 23, 2024 · 5 comments

Comments

@fraricci
Copy link

Hi there.

I had the following happening and wanted to know if it's a bug or it's more a
misuse of the package on my end.

I have an org document with some src blocks with a remote python session.
When that session ends I run that cell by accident, the cell is "locked" and any
edits is forbidden. I think this is done using an overlay. Now, since that session
does not exist anymore, the connection hangs for a while and I just stop it (C-g).
But, the overlay stays and that part of the buffer is not editable anymore.

Now, should I just wait that jupyter-emacs realizes that the session has gone,
gets back to me with some message, and unlocks that src block?
Or this logic is not implemented yet.
Or just be careful not to run cells connected to dead sessions ;-)

What I ended up doing is to remove the overlay manually with an dedicated
emacs function with the start and end of that region, but it's pretty annoying.

Any feedback is appreciate.

Thanks

@5183nischal
Copy link

I have observed this too but can't reliably recreate on local jupyter sessions.

@nnicandro
Copy link
Collaborator

Making a source block non-editable during execution is a new feature that I added so that it would be more obvious that that execution is taking place. There may be some kinks to work out. It does look like some logic needs to be implemented to handle this case and is not a user error.

@fraricci
Copy link
Author

fraricci commented Jun 4, 2024

Thanks for your clear reply! I actually found this new feature useful and good looking. So, yeah, it just needs some logic to make it editable again in case of issues.

On a similar line, actually, I always wanted to have something in the modeline that makes clear the kernel status, but not sure how to do it.

@nnicandro
Copy link
Collaborator

On a similar line, actually, I always wanted to have something in the modeline that makes clear the kernel status, but not sure how to do it.

You can start with something like

(jupyter-org-with-src-block-client
 (equal (jupyter-execution-state jupyter-current-client) "busy"))

But this would only work with point inside a source block. I don't know what would make sense if you wanted this to work outside of a source block since there can be many sessions associated with a single Org file.

@veprbl
Copy link

veprbl commented Aug 1, 2024

Workaround to remove the lock:

(defun my/org-jupyter-remove-overlay ()
  (interactive)
  (jupyter-org--remove-overlay (jupyter-org-request-at-point))
  (jupyter-org-abort (jupyter-org-request-at-point)))

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

4 participants