Using an image - tikk3r/flocs GitHub Wiki
Programs can be run in two ways: indirectly through singularity shell or directly through singularity exec. As their names imply, the shell command starts a shell in the container, from which you can then access its contents. Alternatively, one can directly execute a command in the containers environment, by running singularity exec <command>.
Most likely you'll want to write back files after your work is done. By default, only a small set of folders are accessible from within the image, the rest of the filesystem is not. To access other folders on your computer or over the network, you will have to bind them, so that the container can access them. Then you can modify existing files or write new ones to your heart's content. This is achieved with the --bind or -B flag after shell or exec.
For example, if your command needs to acces /some/data/directory, you would bind it with
singularity exec --bind /some/data/directory,/some/other/directory <image> <command>
or
singularity exec -B /some/data/directory,/some/other/directory <image> <command>
These guides are based off of the Fedora images. Here all software is installed under /opt/lofar. Note that this is not the case for the KERN images.
For the sake of options, we are going to assume separate directories for the software containing your prefactor and losoto installations, the data directory and the runtime/working directories, respectively.
The prefactor pipeline is run under the genericpipeline framework, provided by the LOFAR software in the image. You will have to configure the pipeline.cfg and Pre-Facet-Calibrator.parset or Pre-Facet-Target.parset files. The parsets should have the LoSoTo executable eventually pointed to /opt/lofar/losoto/bin/losoto, so set e.g. losoto_directory = /opt/lofar/losoto. For pipeline.cfg, you will need to adjust the following settings in the [DEFAULT] section:
[DEFAULT]
lofarroot=/opt/lofar/lofar
casaroot=/opt/lofar/casacore
pyraproot=
hdf5root=
wcsroot=/usr/lib64
aoflaggerroot=/opt/lofar/aoflagger
pythonpath=/opt/lofar/lofar/lib64/python2.7/site-packages
runtime_directory=/path/to/runtime
recipe_directories=[%(pythonpath)s/lofar,%(pythonpath)s/lofarpipe/recipes,/path/to/prefactor]
working_directory=/path/to/working
task_files = [%(lofarroot)s/share/pipeline/tasks.cfg]
After all files are properly set up, running the pipeline is as simple as running
singularity exec -B /path/to/software,/path/to/data,/path/to/rundir,/path/to/workdir <image> genericpipeline.py -d -c pipeline.cfg Pre-Facet-Calibrator.parset