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

Resumbable remote sessions #77

Open
MasonProtter opened this issue Feb 17, 2022 · 3 comments
Open

Resumbable remote sessions #77

MasonProtter opened this issue Feb 17, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@MasonProtter
Copy link
Contributor

I do a lot of work on a remote machine that has very hefty startup costs, and there's at least two different client machines I find myself accessing the remote machine from.

One thing I do to work around this is I will start up a Pluto or Jupyter notebook in a tmux session on the remote machine and then ssh -L into that machine so I can access those notebooks from my local browser. I want to move away from this workflow, and keep more stuff within emacs.

Is there an easy way we can support connecting julia-snail to an already existing Julia session on a remote machine? I've gotten remote stuff working on that machine, but I'll lose my session if I restart the client or switch clients.

@gcv
Copy link
Owner

gcv commented Feb 17, 2022

I’ve thought about this before. Two moving parts have to be made to work. One is the REPL display and connecting to it. The second is to sync the Emacs state of the Snail connection with the Julia side.

There might be a trick possible where a remote Julia REPL runs under tmux, and reconnects to an existing session. I have not thought about the ssh tunnel + tmux + julia incantation required to pull it off. A better solution is to implement the Julia REPL in Elisp, but that’s a lot of work. In either case, state resync should be approachable once that works.

I won’t have time to work on this feature in the coming months, unfortunately. I can help with ideas and should be able to review PRs if someone wants to tackle this work.

@gcv gcv added the enhancement New feature or request label Feb 17, 2022
@MasonProtter
Copy link
Contributor Author

I'm pretty skeptical of the idea of implementing the repl in elisp. Sounds like anything other than a tremendous amount of effort would result in a subpar experience. I suspect that instead we could just log and store information in the JuliaSnail module and then we'd just need emacs to query that module, right?

@gcv
Copy link
Owner

gcv commented Feb 17, 2022

I don’t know about “tremendous”, but I agree that a REPL reimplementation needs a good level of polish before it’s useful (Pkg and help integration are a must, but don’t seem that daunting to me). SLIME and CIDER do a good job of reimplementing REPLs for Common Lisp and Clojure, though starting from a much lower baseline than Julia. Emacs has a comint-mode from which to start building such things. But yeah, it’ll all take time I don’t have right now.

With luck, it might be simpler than that to sync state. Based on a superficial look at where I expect to find problems, the only place where state has to get managed in a weird way is julia-snail--cache-proc-implicit-file-module for implicit module support.

Because xref and autocomplete rely on Julia-side code, that should work fine, though their caches might have to be force-reset on a reconnect.

If you want to give it a shot, take a look at julia-snail--launch-command. If there’s a good incantation that can either create or connect to a configurable named tmux session, that function can be modified to use it. Once that works, JuliaSnail.start will have to be made smarter (detect that it’s already running or something — I’m not sure off-hand).

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

No branches or pull requests

2 participants