connect: run the GUI on a cluster node, browse it locally (magnetics-connect)#89
Open
matt-pharr wants to merge 2 commits into
Open
connect: run the GUI on a cluster node, browse it locally (magnetics-connect)#89matt-pharr wants to merge 2 commits into
matt-pharr wants to merge 2 commits into
Conversation
Run the server on a cluster work node, browse it locally — from a laptop off-site or a NoMachine desktop on the site gateway. One ssh connection carries the -L tunnel and the server (loopback-only, free port asked from the remote, real node name reported since submit nodes are load-balanced); the forced pty SIGHUPs the server on disconnect so nothing is orphaned on a shared node. Stdlib-only and standalone so it also runs as a bare python3 connect.py on gateways with no magnetics install. Verified live laptop -> cybele -> omega-b: tunnel, readiness poll, streamed remote logs, and clean teardown. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Running the GUI on an omega work node (the NoMachine -> cybele -> omega flow) sent the remote backend's ssh to omega.gat.com *from* omega. That node's known_hosts has no entry for it, so ssh stopped at the host-key confirmation prompt — which a server process has no tty to answer. The pull sat at 0% forever instead of failing. on_cluster_host() compares our short hostname against the device's configured cluster host, gated on already being inside the site domain, so load-balanced submit nodes (omega-a/-b) and workers (omega25) all match the configured omega.gat.com. The site gateway does NOT match: from cybele, ssh to omega is still the correct path. Where it matches, the pull runs in-process — toksearch when importable, else mdsthin straight to mdsip, which needs no ssh on-site. MAGNETICS_ON_CLUSTER forces either answer. Verified on omega-a: the same --backend remote pull that hung now reports 'already on the cluster; remote->mdsthin' and fetches. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Users at GA reach the analysis stack by remote-desktopping (NoMachine) into a
virtual workstation on the cybele login cluster, then SSHing to a omega
work node. That breaks the webapp: the server's
127.0.0.1:PORTis on omega,but the browser is on cybele.
The fix is not an X-forwarded browser — it's the standard SSH tunnel, which
rides the connection you're already making. This adds a launcher that does the
whole dance in one command, abstracted over host/gateway so it works from a
laptop off-site, from a site gateway desktop, or toward any cluster with the
same login-node pattern (flux, feyn, …).
What it does
magnetics-connect <host>opens one authenticated SSH connection that:are load-balanced — "omega" resolves to omega-a or omega-b run to run);
bash -lcsomodule/profile PATHs apply;
-Lport-forward on that same connection;Only HTTP crosses the wire: fetches and fits run next to the data, plots stream
back. Ctrl-C stops both ends — the forced remote pty SIGHUPs the server, so
nothing is orphaned on a shared node.
Why a tunnel rather than binding 0.0.0.0
I measured the firewall: cybele → omega on a high TCP port is not blocked, so
a direct bind would "work". It's still the wrong default — it exposes an
unauthenticated API that triggers data fetches and serves shot data to the whole
GA internal network, and it collides when two users pick the same port. A
direct-bind mode should come with a Jupyter-style access token; that's a
follow-up, not this PR.
Standalone by design
src/magnetics/connect.pyis stdlib-only and self-contained so it runs on agateway node with only system python3 and no magnetics install:
Verified under Python 3.9 (cybele ships 3.9.25). CLAUDE.md notes the constraint
so it isn't refactored away.
Verification
logs streamed back with an
[omega]prefix, clean teardown with zero orphanedprocesses on the node. Repeated against a real install of this wheel on omega:
the bundled GUI and
/api/*both serve through the tunnel.tests/test_connect_launcher.py) with ssh/subprocessfaked, covering probe → tunnel → serve command construction, the jump flag,
{port}substitution, data-dir quoting, probe failure, and thenever-became-ready path.
ty check.Follow-ups (not in this PR)
module load magneticsreplaces themanual install.
--host 0.0.0.0mode for users who'd rather skipthe tunnel.
🤖 Generated with Claude Code