Running slicer scripts on headless server
You'll need:
- Access to the server (merlin)
- SlicerLabkeyExtension
- DORA/Data pre-processing and transfer
- Access to labkey (certificate, username)
Access to the server
Ask andrej.studen@ijs.si to setup access. You'll get a username and a password, which should be distinct from your key password and labkey access password. You log in to your account using ssh:
ssh username@merlin.fmf.uni-lj.si
Merlin is a headless server meaning that X11 based graphical interfaces are not available. All management is done through terminal based instructions. Get acquianted with BASH to help you along. As an editor I find VI/VIM priceless, but it does take a while to get used to it. To edit a file, start VIM with:
vi file
Software
Download software from git. To simplfy path setting, partially done in code, you should place your code in ~/software/src
directory, and rename data-pre-processing to DORA:
cd
mkdir -p software/src
cd software/src
git clone git@wiscigt.powertheword.com:andrej.studen/SlicerLabkeyExtension.git
git clone git@wiscigt.powertheword.com:dora/data-pre-processing.git
mv data-pre-processing DORA
Access to LabKey
Since you'll perform silent login to the LabKey site, your credentials must be available to the code. Do that by placing a setup file in your ~/.labkey
directory (creating it if neccesary) and adjusting the variables. The file will contain your personal data (passwords for certificate and LabKey), so protect it by allowing read-only user access once finished:
chmod a-w ~/.labkey/networkConfig.json
chmod a-r ~/.labkey/networkConfig.json
chmod u+r ~/.labkey/networkConfig.json
cd ~/.labkey
ln -s networkConfig.json Remote.json
You'll also need a separate key/certificate file. To get those from p12, do:
openssl pkcs12 -in astuden.p12 -nocerts -out astuden.key
openssl pkcs12 -in astuden.p12 -clcerts -nokeys -out astuden.crt
You should also download the CA certificate.
Setup and test the software
You should set the settings in ~/software/src/SlicerLabkeyExtension/slicerScripts/env.sh
. There is a template. Since you'll be running identical binary, the only change is to set DISPLAYID, which should be unique by user. Consult andrej.studen@ijs.si to get a good number. To set the number:
cd ~/software/src/SlicerLabkeyExtension/slicerScripts
cp env.sh.sample env.sh
vi env.sh
#edit DISPLAYID to the selected value
The standard way to run a script is:
~/software/src/SlicerLabkeyExtension/slicerScripts/runSlicer.sh ~/software/src/DORA/slicerScripts/test.py
The command exits, as Slicer runs in background xpra
virtual server, mimicking
graphic functionality. The output of the code is logged to ~/logs/runSlicer.log
, so direct output can be tracked by:
tail -f ~/logs/runSlicer.log
Once you see a Done
output, the script is done.
Running analysis scripts
The standard way to run a script is:
~/software/src/SlicerLabkeyExtension/slicerScripts/runSlicer.sh ~/software/src/DORA/slicerScripts/libraDensity.py
tail -f ~/logs/runSlicer.log
Matlab script
By default, a matlab script runLibra.m is run. Variables LIBRA
, INPUTFILE
and OUTDIR
are set by commands prior to runLibra
execution start. If you need to run other command, you can update runLibra.m script in ~/software/src/DORA/matlab
directory.