Skip to content
Snippets Groups Projects
Commit 1345a983 authored by Martin Schroschk's avatar Martin Schroschk
Browse files

Refactor variable names for workspace name and path

parent 1633f5eb
No related branches found
No related tags found
2 merge requests!679Automated merge from preview to main,!659Check ws allocation
...@@ -245,33 +245,33 @@ calling the actual software to do your computation). ...@@ -245,33 +245,33 @@ calling the actual software to do your computation).
test ! -f "${INPUTFILE}" && echo "Error: Could not find the input file ${INPUTFILE}" && exit 1 test ! -f "${INPUTFILE}" && echo "Error: Could not find the input file ${INPUTFILE}" && exit 1
# Allocate workspace. Adjust time span to time limit of the job (-d <N>). # Allocate workspace. Adjust time span to time limit of the job (-d <N>).
COMPUTE_DIR=computation_$SLURM_JOB_ID WSNAME=computation_$SLURM_JOB_ID
export WORKSPACE_DIR=$(ws_allocate -F ssd -n ${COMPUTE_DIR} -d 7) export WSDDIR=$(ws_allocate -F ssd -n ${WSNAME} -d 7)
echo ${WORKSPACE_DIR} echo ${WSDIR}
# Check allocation # Check allocation
test -z "${WORKSPACE_DIR}" && echo "Error: Cannot allocate workspace ${COMPUTE_DIR}" && exit 1 test -z "${WSDIR}" && echo "Error: Cannot allocate workspace ${WSDIR}" && exit 1
# Change to workspace directory # Change to workspace directory
cd ${WORKSPACE_DIR} cd ${WSDIR}
# Adjust the following line to invoke the program you want to run # Adjust the following line to invoke the program you want to run
srun name_of_the_program_you_want_to_run_here < "${INPUTFILE}" > logfile.log srun name_of_the_program_you_want_to_run_here < "${INPUTFILE}" > logfile.log
# Save result files into user home # Save result files, e.g. into your user home
# Compress results with bzip2 (which includes CRC32 Checksums) # Compress results with bzip2 (which includes CRC32 Checksums)
bzip2 --compress --stdout -4 "${WORKSPACE_DIR}" > $HOME/gaussian_job-$SLURM_JOB_ID.bz2 bzip2 --compress --stdout -4 "${WSDIR}" > $HOME/gaussian_job-$SLURM_JOB_ID.bz2
RETURN_CODE=$? RETURN_CODE=$?
COMPRESSION_SUCCESS="$(if test ${RETURN_CODE} -eq 0; then echo 'TRUE'; else echo 'FALSE'; fi)" COMPRESSION_SUCCESS="$(if test ${RETURN_CODE} -eq 0; then echo 'TRUE'; else echo 'FALSE'; fi)"
# Clean up workspace # Clean up workspace
if [ "TRUE" = ${COMPRESSION_SUCCESS} ]; then if [ "TRUE" = ${COMPRESSION_SUCCESS} ]; then
test -d ${WORKSPACE_DIR} && rm -rf ${WORKSPACE_DIR}/* test -d ${WSDIR} && rm -rf ${WSDIR}/*
# Reduces grace period to 1 day! # Reduces grace period to 1 day!
ws_release -F ssd ${COMPUTE_DIR} ws_release -F ssd ${WSNAME}
else else
echo "Error with compression and writing of results" echo "Error with compression and writing of results"
echo "Please check the folder \"${WORKSPACE_DIR}\" for any partial(?) results." echo "Please check the folder \"${WSDIR}\" for any partial(?) results."
exit 1 exit 1
fi fi
``` ```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment