benchmark-repository-rs/examples/test-job.sh

42 lines
844 B
Bash
Executable File

#!/bin/bash
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --exclusive
#SBATCH --partition=kr
tmp_dir=/home/pluehne/tmp
echo "job ID: $JOB_ID"
echo "job key: $JOB_KEY"
echo "job result repository URL: $JOB_RESULT_REPOSITORY_URL"
mkdir -p "$tmp_dir"
dir="$tmp_dir"/"job-$JOB_ID"
if [[ -d $dir ]]
then
rm -rf "$dir"
fi
mkdir -p "$dir"
pushd "$dir"
git clone "$JOB_RESULT_REPOSITORY_URL" repository
pushd repository
git config user.name "Potassco Bot"
git config user.email "bot@potassco.org"
echo "start of benchmark output of job $JOB_KEY" > test-output
sleep 10
start_time=$(date +%s%N)
echo "end of benchmark output of job $JOB_KEY" >> test-output
git add test-output
git commit -m "Test update"
git push
end_time=$(date +%s%N)
popd
echo $(expr "$end_time" - "$start_time") >> "$tmp_dir"/overhead
popd