Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Helpful scripts for working at NCI
To use these scripts on NCI infrastructure do the following:

```
module use /g/data/hh5/public/modules
module use /g/data/xp65/public/modules
module load nci-scripts
```

Expand All @@ -22,7 +22,7 @@ $ uqstat
qcost
------

Calculates what it would cost, in SU, for a job submitted to the PBS system with the same configuration.
Calculates what it would cost, in SU, for a job submitted to the PBS system with the same configuration.
The information is all contained in the [PBS queue information is provided by NCI](https://opus.nci.org.au/display/Help/Queue+Limits)
but it can be tedious to determine which configuration of queue and memory request should be used
to minimise job cost. `qcost` was created to make this process easier.
Expand All @@ -32,8 +32,8 @@ Usage:
./qcost -h
usage: qcost [-h] -q QUEUE -n NCPUS -m MEM [-t TIME]

Return what it would cost (in SUs) for a PBS job submitted on gadi with the same
configuration. No checking is done to ensure requests are within queue limits.
Return what it would cost (in SUs) for a PBS job submitted on gadi with the same
configuration. No checking is done to ensure requests are within queue limits.


optional arguments:
Expand All @@ -59,15 +59,15 @@ $ qcost -q normal -n 4 -m 60GB -t 3:00:00
gadi_jupyter
------------

Run a Jupyter notebook on Gadi, displaying it in a local web browser.
Run a Jupyter notebook on Gadi, displaying it in a local web browser.

**THIS MUST BE RUN FROM YOUR OWN COMPUTER**

So the first step is to clone this repository to your local workstation. It
works on mac/linux/windows (for windows using e.g. [git bash](https://gitforwindows.org/)
or [Windows Ssubsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install)).

By default the script will spawn a job with a single CPU, 4GB of memory
By default the script will spawn a job with a single CPU, 4GB of memory
and a walltime of 1 hour.

Command line options can be used to alter the resources requested, the
Expand Down Expand Up @@ -106,25 +106,25 @@ Queue Options:

```

You will need to have ssh keys setup for logging into gadi. There is a
You will need to have ssh keys setup for logging into gadi. There is a
[guide on how to do this on the CMS Wiki](http://climate-cms.wikis.unsw.edu.au/CLEx_induction#Step_2:_Set_up_your_Connection).

vdi_jupyter.py
--------------

Run a Jupyter notebook on
Run a Jupyter notebook on
[NCI Virtual Desktop Infrastructure (VDI)](https://opus.nci.org.au/display/Help/VDI+User+Guide), displaying it in a local web browser (run from your own computer).

To run:
```
python nci_scripts/vdi_jupyter.py
```

This script requires the `pexpect` package. To make a `conda` environment with the required
This script requires the `pexpect` package. To make a `conda` environment with the required
packages:
```
conda env create -f nci_scripts/vdi_environment.yml
```
```
then activate the environment:
```
conda activate jupyter_vdi
Expand Down
23 changes: 15 additions & 8 deletions gadi_jupyter
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,16 @@ set -eu
WORKDIR="$WORKDIR"
mkdir -p "\$WORKDIR"

# Check if a hh5 member
if [ ! -d /g/data/hh5 ]; then
echo "ERROR: \$USER is not a member of hh5. Join at https://my.nci.org.au/mancini/project/hh5/join" >&2
# Check if an xp65 member
if [ ! -d /g/data/xp65 ]; then
echo "ERROR: \$USER is not a member of xp65. Join at https://my.nci.org.au/mancini/project/xp65/join" >&2
echo "x x x x ERROR"
exit
fi

# Check if an ik11 member
if [ ! -d /g/data/ik11 ]; then
echo "ERROR: \$USER is not a member of ik11. Join at https://my.nci.org.au/mancini/project/ik11/join" >&2
echo "x x x x ERROR"
exit
fi
Expand All @@ -200,8 +207,8 @@ cat > "\$WORKDIR/runjp.sh" <<EOQ

module purge

eval "\\\$(/g/data/hh5/public/apps/miniconda3/bin/conda shell.bash hook)"
conda activate "${CONDA_ENV}"
module use /g/data/xp65/public/modules
module load conda/analysis3

set -eu

Expand All @@ -228,8 +235,8 @@ export DASK_TEMPORARY_DIRECTORY="\\\$TMPDIR"
$STRACE jupyter lab --NotebookApp.token="\\\$TOKEN" --no-browser --ip="\\\$HOSTNAME" --port "\\\$PORT" --port-retries=0
EOQ

# Required for conda
storage="gdata/hh5"
# Required for conda + nci_scripts
storage="gdata/xp65+gdata/ik11"

if [ -n "$STORAGE" ]; then
storage="$STORAGE+\$storage"
Expand Down Expand Up @@ -334,7 +341,7 @@ fi
set -e
echo

$SSH "$LOGINNODE" /g/data/hh5/public/apps/nci_scripts/qmonitor $jobid
$SSH "$LOGINNODE" /g/data/ik11/nci_scripts/qmonitor $jobid

# Move the cursor past the progress bars
echo
Expand Down
2 changes: 1 addition & 1 deletion python-analysis3
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

# Always the current stable analysis3 python

/g/data/hh5/public/apps/miniconda3/envs/analysis3/bin/python "$@"
/g/data/xp65/public/apps/miniconda3/envs/analysis3/bin/python "$@"
2 changes: 1 addition & 1 deletion qcost
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/g/data3/hh5/public/apps/nci_scripts/python-analysis3
#!/g/data/xp65/public/apps/nci_scripts/python-analysis3

import pandas
import argparse
Expand Down
2 changes: 1 addition & 1 deletion qmonitor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/g/data/hh5/public/apps/nci_scripts/python-analysis3
#!/g/data/xp65/public/apps/nci_scripts/python-analysis3
# Copyright 2020 Scott Wales
# author: Scott Wales <scott.wales@unimelb.edu.au>
#
Expand Down
2 changes: 1 addition & 1 deletion qsubs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -eu

storage="gdata/hh5"
storage="gdata/xp65"
for p in $(id -nG); do
if [ $p = "access.dev" ]; then continue; fi
if [ $p = "access.admin" ]; then continue; fi
Expand Down
2 changes: 1 addition & 1 deletion qtools.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/g/data/hh5/public/apps/nci_scripts/python-analysis3
#!/g/data/xp65/public/apps/nci_scripts/python-analysis3
# Copyright 2020 Scott Wales
# author: Scott Wales <scott.wales@unimelb.edu.au>
#
Expand Down
4 changes: 2 additions & 2 deletions uqstat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/g/data3/hh5/public/apps/nci_scripts/python-analysis3
#!/g/data/xp65/public/apps/nci_scripts/python-analysis3

import pandas
import subprocess
Expand Down Expand Up @@ -80,7 +80,7 @@ def nqstat_df(project):
token = pymunge.encode().decode('utf-8')
headers = { 'Authorization': "MUNGE %s" % (token) }
params = {'project': project}

response = requests.get(url, params=params, headers=headers, timeout=120.0)
response.raise_for_status()

Expand Down
6 changes: 3 additions & 3 deletions vdi_jupyter.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def main(args):
logging.info('Unable to launch new VDI session:\n'+r.before.decode())

params.update(m.groupdict())
time.sleep(2) # TODO: instead of waiting, should check for confirmation
time.sleep(2) # TODO: instead of waiting, should check for confirmation
# use has-started

logging.info("Determine jobid for VDI session...{jobid}".format(**params))
Expand All @@ -222,7 +222,7 @@ def main(args):
logging.info("Running Jupyter on VDI...")

setupconda = params.get('setupconda',
"""module use /g/data3/hh5/public/modules
"""module use /g/data/xp65/public/modules
&& module load conda/analysis3-unstable
""".replace('\n', ' '))

Expand Down Expand Up @@ -257,7 +257,7 @@ def main(args):
# optional: terminate to close the vdi session?

def main_argv():

args = parse_args(sys.argv[1:])

main(args)
Expand Down