Skip to content
Snippets Groups Projects
Commit 6d2d2511 authored by kasravi1's avatar kasravi1
Browse files

add group name into args

parent 6c95a2d4
No related branches found
No related tags found
No related merge requests found
...@@ -6,26 +6,28 @@ PARTITION_NAME="" ...@@ -6,26 +6,28 @@ PARTITION_NAME=""
SINGULARITY_BASE_IMG_PATH="" SINGULARITY_BASE_IMG_PATH=""
SINGULARITY_FINAL_IMG_NAME="" SINGULARITY_FINAL_IMG_NAME=""
REQUIREMENT_PATH="" REQUIREMENT_PATH=""
GROUP_NAME=""
# Parse options # Parse options
while getopts "A:P:S:R:F:" opt; do while getopts "A:G:P:S:R:F:" opt; do
echo "Processing option: $opt with argument: $OPTARG" # Add this for debugging echo "Processing option: $opt with argument: $OPTARG" # Add this for debugging
case $opt in case $opt in
A) ACCOUNT_NAME=$OPTARG ;; A) ACCOUNT_NAME=$OPTARG ;;
G) GROUP_NAME=$OPTARG ;;
P) PARTITION_NAME=$OPTARG ;; P) PARTITION_NAME=$OPTARG ;;
S) SINGULARITY_BASE_IMG_PATH=$OPTARG ;; S) SINGULARITY_BASE_IMG_PATH=$OPTARG ;;
R) REQUIREMENT_PATH=$OPTARG ;; R) REQUIREMENT_PATH=$OPTARG ;;
F) SINGULARITY_FINAL_IMG_NAME=$OPTARG ;; F) SINGULARITY_FINAL_IMG_NAME=$OPTARG ;;
*) *)
echo "Usage: $0 -A <account_name> -P <partition_name> -S <singularity_base_image_path> -R <requirement.txt_path> F <singularity_image_name>" echo "Usage: $0 -A <account_name> -G <group_name> -P <partition_name> -S <singularity_base_image_path> -R <requirement.txt_path> F <singularity_image_name>"
exit 1 exit 1
;; ;;
esac esac
done done
# Check if required arguments are provided # Check if required arguments are provided
if [ -z "$ACCOUNT_NAME" ] || [ -z "$PARTITION_NAME" ] || [ -z "$SINGULARITY_BASE_IMG_PATH" ] || [ -z "$REQUIREMENT_PATH" ] || [ -z "$SINGULARITY_FINAL_IMG_NAME" ]; then if [ -z "$ACCOUNT_NAME" ] || [ -z "$GROUP_NAME" ] || [ -z "$PARTITION_NAME" ] || [ -z "$SINGULARITY_BASE_IMG_PATH" ] || [ -z "$REQUIREMENT_PATH" ] || [ -z "$SINGULARITY_FINAL_IMG_NAME" ]; then
echo "Usage: $0 -A <account_name> -P <partition_name> -S <singularity_base_image_path> -R <requirement.txt_path> F <singularity_image_name>" echo "Usage: $0 -A <account_name> -G <group_name> -P <partition_name> -S <singularity_base_image_path> -R <requirement.txt_path> F <singularity_image_name>"
exit 1 exit 1
fi fi
...@@ -62,7 +64,7 @@ module load Stages ...@@ -62,7 +64,7 @@ module load Stages
module try-load GCC Apptainer-Tools module try-load GCC Apptainer-Tools
# Define the directory path # Define the directory path
DIR="/p/project1/${ACCOUNT_NAME}/${USER}/apptainer" DIR="/p/project1/${GROUP_NAME}/${USER}/apptainer"
# Ensure directory exists # Ensure directory exists
if [ ! -d "\$DIR" ]; then if [ ! -d "\$DIR" ]; then
...@@ -74,7 +76,7 @@ else ...@@ -74,7 +76,7 @@ else
fi fi
# Create temporary directory for Apptainer build # Create temporary directory for Apptainer build
TMP=\$(mktemp -p /p/scratch/${ACCOUNT_NAME}/apptainer -d) || { echo "Failed to create temporary directory"; exit 1; } TMP=\$(mktemp -p /p/scratch/${GROUP_NAME}/apptainer -d) || { echo "Failed to create temporary directory"; exit 1; }
export APPTAINER_TMPDIR=\$TMP export APPTAINER_TMPDIR=\$TMP
# Create the Singularity definition file in TMP # Create the Singularity definition file in TMP
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment