forked from brainlife/app-template-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain
executable file
·49 lines (39 loc) · 1.51 KB
/
main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
#SBATCH --job-name=qsmxt
#SBATCH --ntasks-per-node=4
#SBATCH --mem=16G
#SBATCH --time=01:00:00
container=qsmxt_7.2.2_20241029
md5sum=fc2c9969ea4779a9fb6eb56a0e2145ad
echo "[INFO] Checking SINGULARITY_BINDPATH..."
echo $SINGULARITY_BINDPATH
echo "[INFO] Checking for existing container..."
if [[ -f "${container}.simg" ]]; then
echo "[INFO] Found existing container."
echo "[INFO] Checking md5sum..."
if [[ "$(md5sum ${container}.simg | awk '{print $1}')" == "${md5sum}" ]]; then
echo "[INFO] md5sum matched. Skipping download."
else
echo "[INFO] md5sum mismatch. Redownloading container."
rm -f ${container}.simg
fi
fi
if [[ ! -f "${container}.simg" ]]; then
echo "[INFO] Pulling QSMxT singularity container... (US)"
curl -s -X GET https://neurocontainers.neurodesk.org/${container}.simg -o ${container}.simg
echo "[INFO] Finished pulling QSMxT singularity container!"
else
echo "[INFO] Using existing container."
fi
if [[ ! -f "${container}.simg" ]] || [[ "$(md5sum ${container}.simg | awk '{print $1}')" != "${md5sum}" ]]; then
echo "[ERROR] Container not found or md5sum mismatch. Exiting..."
exit 1
fi
echo "[INFO] Current directory is $(pwd)"
echo "[INFO] Listing files in current directory $(ls)"
ls -l
echo "[INFO] Installing pip dependencies..."
singularity exec ${container}.simg pip install -U pip
singularity exec ${container}.simg pip install -U scikit-image
echo "[INFO] Starting main.py..."
singularity exec ${container}.simg python3 main.py