Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jupyter_lab_slurm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Hoese
jupyter_lab_slurm
Commits
381a0bb2
Commit
381a0bb2
authored
6 years ago
by
David Hoese
Browse files
Options
Downloads
Patches
Plain Diff
Update scripts to find unused ports
parent
1caa8abc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+1
-0
1 addition, 0 deletions
README.md
start_jupyter_lab.sbatch
+13
-5
13 additions, 5 deletions
start_jupyter_lab.sbatch
start_jupyter_lab.sh
+2
-2
2 additions, 2 deletions
start_jupyter_lab.sh
with
16 additions
and
7 deletions
README.md
+
1
−
0
View file @
381a0bb2
...
...
@@ -57,3 +57,4 @@ And use the password set up during installation.
server and 8787 for dask clients by default.
*
Jupyter lab does not currently allow connecting to unix sockets (sockets
with a pathname). See https://github.com/jupyter/notebook/issues/2503.
This diff is collapsed.
Click to expand it.
start_jupyter_lab.sbatch
+
13
−
5
View file @
381a0bb2
...
...
@@ -10,14 +10,22 @@
module purge
oops
()
{
echo
"OOPS:
$*
"
exit
1
echo
"OOPS:
$*
"
exit
1
}
#export HDF5_USE_FILE_LOCKING="FALSE"
#export PYTROLL_CHUNK_SIZE="2048"
CONDA_ENV
=
/home/davidh/miniconda3
source
$CONDA_ENV
/bin/activate pangeo
echo
"ssh -N -L 8888:
`
hostname
`
:8888 -L 8787:
`
hostname
`
:8787
$USER
@iris"
|
tee
-a
${
HOME
}
/.jupyter_lab_connect.txt
jupyter lab
--no-browser
--ip
=
`
hostname
`
--port
=
8888
# Hack to find two useable ports
PORTS
=
$(
python
-c
'import socket; s1=socket.socket(); s2=socket.socket(); s1.bind(("", 0)); s2.bind(("", 0)); print(s1.getsockname()[1], s2.getsockname()[1]); s1.close(); s2.close()'
)
export
JLAB_PORT
=
$(
echo
$PORTS
|
cut
-d
' '
-f1
)
export
DASK_PORT
=
$(
echo
$PORTS
|
cut
-d
' '
-f2
)
# Write out a usable SSH command to connect to jupyter lab
echo
"ssh -N -L 8888:
`
hostname
`
:
${
JLAB_PORT
}
-L 8787:
`
hostname
`
:
${
DASK_PORT
}
$USER
@iris"
|
tee
-a
${
HOME
}
/.jupyter_lab_connect.txt
# Start jupyter lab
jupyter lab
--no-browser
--ip
=
`
hostname
`
--port
${
JLAB_PORT
}
This diff is collapsed.
Click to expand it.
start_jupyter_lab.sh
+
2
−
2
View file @
381a0bb2
...
...
@@ -10,7 +10,7 @@ CONNECT_FILE="${HOME}/.jupyter_lab_connect.txt"
rm
-f
$CONNECT_FILE
# Tell slurm to run jupyter lab and write ssh command to CONNECT_FILE
sbatch
--quiet
"
${
SCRIPT_HOME
}
/start_jupyter_lab.sbatch"
sbatch
--quiet
"
${
SCRIPT_HOME
}
/start_jupyter_lab.sbatch"
>
/dev/null 2>&1
# Wait for slurm to start the job on a compute node
while
[
!
-f
$CONNECT_FILE
]
;
do
...
...
@@ -19,7 +19,7 @@ while [ ! -f $CONNECT_FILE ]; do
done
# Wait for jupyter lab to completely start
echo
"Job started, waiting 5 seconds for jupyter lab to start..."
echo
"Job started, waiting 5 seconds for jupyter lab to start..."
>
&2
sleep
5
# Now that we know it has started print out the SSH command the user should
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment