Software Exercise 1.2: Use Apptainer Containers in OSPool Jobs¶
Objective: Submit a job that uses an existing apptainer container; compare default job environment with a specific container job environment.
Why learn this?: By comparing a non-container and container job, you'll better understand what a container can do on the OSPool.
Default environment for jobs¶
First, let's run a job without a container to see what the typical job environment is.
-
Create a bash script named
job-env.shwith the following lines:#!/bin/sh grep "PRETTY_NAME" /etc/os-release python3 --version R --version gcc --versionThis will print out the version of Linux on the computer, the versions of Python and R, and the version of
gcc, a common software compiler. -
Make the script executable:
$ chmod +x job-env.sh -
Run the script on the Access Point.
$ ./job-env.shWhat results did you get?
-
Copy a submit file from a previous OSPool job and edit it so that the script you just wrote is the executable.
-
Submit the job and read the standard output file when it completes. What version of Linux was used for the job? What is the version of
gccor Python?Exploring the pool
If you are curious about what is available by default on the OSPool, you can try submitting many jobs like the one above, and see what they report back. Refer back to yesterday's material for different ways to submit a list of jobs.
Container environment for jobs¶
Now, let's try running that same script inside a container.
-
For this job, we will use the OSG-provided Ubuntu "Focal" image, as we did in the previous exercise. The
container_imagesubmit file option will tell HTCondor to use this container for the job:container_image = osdf:///osg-public/school/2026/ubuntu24.04.sif -
If the submit file you copied has something like
requirements = (OSGVO_OS_STRING == "RHEL 9"), remove that. When you use containers, you should not specify an OS in the requirements as that will unnecessarily limit the number of resources you can run on. -
Based on our previous test of this container, what do you expect the job to output?
-
Submit the job and read the standard output file when it completes.
Apply to Your Work¶
How important is it for your jobs to have a consistent software environment? How portable are scripts and software that you use?