Application

In mUQSA platform, the execution of user applications or models is facilitated through two distinct modes: Preinstalled and Apptainer.

Preinstalled Mode

The Preinstalled mode involves utilizing preinstalled applications or models, that is, the applications or models that are already available on a cluster and have been installed by administrator or user.

Apptainer Mode

In contrast, the Apptainer mode leverages the power of the Apptainer (aka Singularity) software platform, tailored explicitly for creating and running containers optimized for scientific and research computing tasks. Containers serve as lightweight, self-contained environments that encapsulate an application along with their dependencies, and, by isolating it from the OS, ensure consistent execution across diverse computing systems.

Apptainer Definition Files

The creation of Apptainer images involves the utilization of a definition file (refer to Apptainer definition files). Within the context of mUQSA, the process of creating Apptainer images adheres to simple guidelines:

  1. The image should use a directory designated by the path /workdir, from which the evaluated app will be executed. The assumption is that this directory will be mounted from the host system and will be used to exchange the data between the host and container.
  2. The user’s model should be initiated through the %runscript section, within the /workdir directory, and use the $@ argument to enable dynamic parameter passing.

Here’s an illustrative example of an Apptainer definition file:

# Setup
Bootstrap: docker
From: python:3.11.4-alpine3.18

# '/projectile' to store model
# '/workdir' as working directory
%setup
    mkdir -p ${SINGULARITY_ROOTFS}/projectile
    mkdir -p ${SINGULARITY_ROOTFS}/workdir

# copy files to directory where model should be stored
%files
    projectile.py /projectile/projectile.py
    requirements.txt /projectile/requirements.txt

# Add SDK and install model's dependencies
%post
    apk add --update alpine-sdk
    pip install -r /projectile/requirements.txt

# On container run: enter working directory and invoke model.
# This performs all the execution logic in '/workdir' directory.
%runscript
    cd /workdir
    python3 /projectile/projectile.py "$@"

%help
    This is an example image for projectile model.

To build this file, run below commands:

# Assuming that above definition file is in `projectile.def` file
apptainer build --fakeroot projectile.simg projectile.def

This produces the Apptainer image file called projectile.simg, that can be put somewhere to the cluster and then used in mUQSA.

Info

At this stage of development of mUQSA, a user needs to manually copy the image to the remote cluster filesystem and to provide the proper command for the execution of the image with Apptainer, but it will be changed in the next versions of the platform.