Skip to content

Commit

Permalink
test/examples for exit-from-run
Browse files Browse the repository at this point in the history
  • Loading branch information
dmachi committed Jan 24, 2024
1 parent 91e502c commit 7f8c357
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 29 deletions.
22 changes: 0 additions & 22 deletions docs/examples/exit-from-run/Dockerfile

This file was deleted.

18 changes: 15 additions & 3 deletions docs/examples/exit-from-run/README.md
Expand Up @@ -2,10 +2,22 @@

This should be built from the root of the repository as follows:

```bash
apptainer build docs/examples/exit-from-run/apptainer.def scif.sif
apptainer run scif.sif run force_failure || echo "Got non-zero exit code: $? Success!"
```
# apptainer build scif.sif docs/examples/exit-from-run/apptainer.def
```

The force_fail app returns exit code 155
```
# apptainer run scif.sif run force_fail ; echo "Out: $?"
[force_fail] executing /bin/bash /scif/apps/force_fail/scif/runscript
ERROR Return code 155
Out: 155
```

The 'success' app returns exit code 0

```
$ apptainer run scif.sif run success ; echo "Out: $?"
[success] executing /bin/bash /scif/apps/success/scif/runscript
Out: 0
```
9 changes: 6 additions & 3 deletions docs/examples/exit-from-run/apptainer.def
@@ -1,16 +1,19 @@
Bootstrap: docker
From: continuumio/miniconda3

# sudo singularity build scif.simg Singularity
# apptainer build scif.simg docs/examples/exit-from-run/apptainer.def

%runscript
exec /opt/conda/bin/scif "$@"

%files
docs/examples/exit-from-run/recipe.scif /recipe.scif
. /opt/scif
%post
apt-get update && apt-get install -y git build-essential

# Install SCIF
cd /opt && git clone https://www.github.com/vsoch/scif.git
cd scif
cd /opt/scif
/opt/conda/bin/pip install setuptools
/opt/conda/bin/pip install -e .
scif install /recipe.scif
7 changes: 6 additions & 1 deletion docs/examples/exit-from-run/recipe.scif
@@ -1,2 +1,7 @@
%apprun force_fail
exit 155
echo "Calling exit 155"
exit 155

%apprun success
echo "Running succes"
exit 0

0 comments on commit 7f8c357

Please sign in to comment.