jstAnotherCapi commited on
Commit
d0119a7
·
verified ·
1 Parent(s): 5df3605

Upload jupyter_gptossVENV.pbs with huggingface_hub

Browse files
Files changed (1) hide show
  1. jupyter_gptossVENV.pbs +73 -0
jupyter_gptossVENV.pbs ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ #PBS -N khalil_Jpytr_noDelete
3
+ #PBS -l select=1:ncpus=20:mem=180gb:ngpus=1
4
+ #PBS -l walltime=24:00:00
5
+ #PBS -q gpu_1d
6
+ #PBS -o logs/NIDS_output.log
7
+ #PBS -e logs/NIDS_error.err
8
+
9
+ set -euo pipefail
10
+ mkdir -p logs
11
+
12
+ # ---- Load & init conda ----
13
+ module load /app/common/modules/anaconda3-2024.10
14
+ eval "$("$(command -v conda)" shell.bash hook)"
15
+ source activate sbert_khalil
16
+ # ---- Diagnostics to stdout ----
17
+ echo "user: $(whoami)"
18
+ echo "node: $(hostname -s)"
19
+ which python || true
20
+ python -V || true
21
+ which jupyter || true
22
+ jupyter --version || true
23
+
24
+ # ---- Safer runtime dirs ----
25
+ export JUPYTER_RUNTIME_DIR="${PBS_O_WORKDIR}/.jupyter_runtime"
26
+ export JUPYTER_CONFIG_DIR="${PBS_O_WORKDIR}/.jupyter_config"
27
+ mkdir -p "$JUPYTER_RUNTIME_DIR" "$JUPYTER_CONFIG_DIR"
28
+
29
+ # ---- Port setup ----
30
+ port="${PORT:-8883}"
31
+ if ss -ltn 2>/dev/null | grep -q ":$port "; then
32
+ port=$(( (RANDOM % 1000) + 8000 ))
33
+ fi
34
+
35
+ node="$(hostname -s)"
36
+ user="$(whoami)"
37
+ login_host="172.30.30.11"
38
+
39
+ cat <<EOF
40
+ ================ JUPYTER NOTEBOOK INFO ================
41
+ Compute node : ${node}
42
+ Chosen port : ${port}
43
+ Authentication : DISABLED (no token needed)
44
+
45
+ Tunnel option A (simple):
46
+ ssh -N -L ${port}:${node}:${port} ${user}@${login_host}
47
+
48
+ Tunnel option B (robust via ProxyJump):
49
+ ssh -N -J ${user}@${login_host} -L ${port}:localhost:${port} ${user}@${node}
50
+
51
+ Open in browser:
52
+ http://localhost:${port}
53
+
54
+ WARNING: No authentication - ensure your SSH tunnel is secure!
55
+ ========================================================
56
+ EOF
57
+
58
+ # ---- Launch Jupyter Notebook ----
59
+ if python -c "import notebook" 2>/dev/null; then
60
+ echo "Launching Jupyter Notebook..."
61
+ exec python -m notebook \
62
+ --no-browser \
63
+ --ip=0.0.0.0 \
64
+ --port="${port}" \
65
+ --NotebookApp.token='' \
66
+ --NotebookApp.password='' \
67
+ --NotebookApp.disable_check_xsrf=True \
68
+ --MappingKernelManager.cull_idle_timeout=0
69
+ else
70
+ echo "ERROR: Jupyter notebook not found in environment!"
71
+ echo "Try: conda install jupyter notebook"
72
+ exit 1
73
+ fi