Skip to content

Commit fe08c22

Browse files
Merge pull request #1200 from qiboteam/expose-web-multinet
Extend interactive workflow instructions for multinetwork systems
2 parents 14a53ce + 12dd989 commit fe08c22

5 files changed

Lines changed: 248 additions & 398 deletions

File tree

doc/source/tutorials/connect-to-queue.bash

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@ print(s.getsockname()[1])
99
s.close()
1010
EOF
1111

12-
IP=$(hostname -I | cut -d ' ' -f 1)
12+
read -rd '' getip <<EOF
13+
import sys
14+
15+
ips = sys.stdin.read().split(" ")
16+
print([ip for ip in ips if ip.startswith(sys.argv[1])][0])
17+
EOF
18+
19+
SUBNET=""
20+
IP=$(hostname -I | python -c "$getip" "$SUBNET")
1321
PORT=$(python -c "$getport")
1422

1523
echo "Forward your local port with:"
@@ -19,6 +27,6 @@ echo
1927
echo "Connect to:"
2028
echo " https://localhost:9180"
2129

22-
jupyter lab --ip "$IP" --port "$PORT"
30+
jupyter lab --ip "$IP" --port "$PORT" --no-browser
2331
# you can also test this with:
2432
# python -m http.server -b "$IP" "$PORT"

doc/source/tutorials/interactive.rst

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,60 @@ the following script should help automating the process.
3333

3434
Once the required server is dispatched as queue job with the script, the instructions to
3535
connect will appear in the output (usually redirected by the queue system on a file).
36+
37+
38+
.. note::
39+
40+
If the system you are targeting, the *remote computing node*, is actually part of
41+
multiple networks, and you need to discriminate the correct one to use, just add the
42+
subnetwork as a string in the former
43+
44+
E.g. you could use::
45+
46+
SUBNET="192.168.XXX"
47+
48+
to specify a local network whose 3rd byte is ``XXX`` (e.g. ``0``, ``1``, ..., ``255``)
49+
50+
51+
Step-by-step guide
52+
~~~~~~~~~~~~~~~~~~
53+
54+
In case of doubts, let's go step by step through the script usage.
55+
56+
#. the **script** itself is supposed to be executed on the **remote computing node**
57+
(cf. figure above), which is the one with direct access to the resources (thus, the
58+
one which is usually already behind the queue)
59+
#. notice that the instructions printed in the output will direct you to establish a
60+
**further SSH connection**, which will be the bridge between the local system and the
61+
remote computing node, through the access node (cf. figure above), on it can be
62+
established with a further `ssh` command execution on the **local system**
63+
#. eventually, the **client connection** should be established from the same **local
64+
system**
65+
66+
.. admonition:: Example: SLURM + laptop
67+
68+
In the case of SLURM queue system, which is accessible through an access node, where
69+
the user `ssh` from its laptop:
70+
71+
- the script is the one you should `sbatch` - possibly adding to it all the rest of
72+
the logic, as needed
73+
- the further `ssh` command (printed in the instructions) should be run on the laptop
74+
- the final URL to connect can be pasted in a browser on the same laptop (e.g.
75+
Mozilla Firefox)
76+
77+
Further notes
78+
~~~~~~~~~~~~~
79+
80+
.. admonition:: Jupyter tokens
81+
82+
*This is not related to this guide, but just to Jupyter itself.*
83+
84+
When Jupyter opens the browser automatically, it uses a URL containing a *token*, for
85+
ease of access.
86+
If you just specify the address and port, the token will not be included. But you can
87+
find it in the output of the command in the jupyter server (thus in the log of the
88+
queue job, if you are using a queue, as in this guide), and manually insert it in the
89+
page which is presented by Jupyter when the URL token is not used.
90+
91+
More details in Jupyter docs:
92+
https://jupyter-server.readthedocs.io/en/stable/operators/security.html

flake.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525

2626
env = {
2727
QIBOLAB_PLATFORMS = (dirOf config.env.DEVENV_ROOT) + "/qibolab_platforms_qrc";
28+
LD_LIBRARY_PATH = builtins.concatStringsSep ":" (map (p: "${p}/lib") (with pkgs; [
29+
stdenv.cc.cc.lib
30+
zlib
31+
]));
32+
PYTHONBREAKPOINT = "pudb.set_trace";
2833
};
2934

3035
languages = {

0 commit comments

Comments
 (0)