Commit 9055b9ae authored by Małgorzata Wierzba's avatar Małgorzata Wierzba 💬

add singularity example

parent ba772802
# Singularity
This template demonstrates how to build a singularity container using HTCondor.
The `singularity.submit` file runs a simple shell script `` that collects the singularity recipe file `sl.def`, builds a singularity image `sl.simg` and pushes it back to your directory.
To run:
condor_submit singularity.submit
If you want to build your container in an interactive session, you can use the `singularity-interactive.submit` instead:
condor_submit --interactive singularity-interactive.submit
If successful, you should be able to run your container like so:
singularity run sl.simg
## Things to Note
- Please note that in this example the singularity container is built on a compute node. This is convenient, because it allows for the job to be completed faster. More on this can be found in the **Further reading** section below.
- Using a `.submit` file allows you use the `rank = IOPS` option, that is to request for machines with faster local disks (it'll prefer, but not require these machines to be used).
## Further reading
Juseless is a collection of systems. The most important ones are the head node (the one you log into), the data node (which hosts `/home` and `/data`), and the compute nodes.
`/home` and `/data` are shared to all nodes using the Network File System (NFS). This is convenient, because they all can see the same data. But it's obviously slower because everything has to go over the network.
Each compute node has a dedicated [*scratch disk*]( for local temporary files. This is useful because it saves the data node from unneccesary data and traffic, but also benefits jobs which need to read and write a lot. Local disk are faster than the network, so it's a win all around.
Compute jobs see this *scratch disk* as `/tmp` (the reality is more complex than that).
## Prerequisites
This example assumes that it is located in `~/htcondor-templates/singularity`. If you have cloned it elsewhere, adjust the submit file as necessary.
Otherwise, this example is entirely self contained.
# The environment
universe = vanilla
getenv = True
request_cpus = 1
request_memory = 5G
request_disk = 100G
rank = IOPS
# Execution
initialdir = $ENV(HOME)/htcondor-templates/singularity/
log = logs/interactive.$(Cluster).$(Process).log
output = logs/interactive.$(Cluster).$(Process).out
error = logs/interactive.$(Cluster).$(Process).err
# use a dedicated "scratch disk"
cd /tmp
chmod 1777 /tmp
# download the singularity recipe file
git clone
cd htcondor-templates/singularity
# build the singularity image file
sudo singularity build sl.simg sl.def
# push the image file back to your directory
scp sl.simg ~/htcondor-templates/singularity/
# The environment
universe = vanilla
getenv = True
request_cpus = 1
request_memory = 5G
request_disk = 100G
rank = IOPS
# Execution
initialdir = $ENV(HOME)/htcondor-templates/singularity/
executable = $(initialdir)/
transfer_executable = False
# Job
log = logs/$(Cluster).$(Process).log
output = logs/$(Cluster).$(Process).out
error = logs/$(Cluster).$(Process).err
Bootstrap: docker
From: debian:buster-slim
apt-get update
apt-get -y install sl
apt-get clean
apt-get autoremove
export PATH="/usr/games:$PATH"
exec sl
Author Malgorzata Wierzba (
Version 1.0.0
This container allows you to run the most wonderful shell command ever created.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment