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

42 lines
844 B
Bash
Raw Normal View History

2018-11-08 16:02:38 +01:00
#!/bin/bash
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --exclusive
#SBATCH --partition=kr
tmp_dir=/home/pluehne/tmp
2019-03-01 18:02:52 +01:00
echo "job ID: $JOB_ID"
2019-03-02 01:34:16 +01:00
echo "job key: $JOB_KEY"
echo "job result repository URL: $JOB_RESULT_REPOSITORY_URL"
2019-03-01 18:02:52 +01:00
2018-11-08 16:02:38 +01:00
mkdir -p "$tmp_dir"
2019-03-02 00:53:57 +01:00
dir="$tmp_dir"/"job-$JOB_ID"
2018-11-08 16:02:38 +01:00
if [[ -d $dir ]]
then
rm -rf "$dir"
fi
mkdir -p "$dir"
pushd "$dir"
2019-03-02 00:53:57 +01:00
git clone "$JOB_RESULT_REPOSITORY_URL" repository
2018-11-08 16:02:38 +01:00
pushd repository
git config user.name "Potassco Bot"
git config user.email "bot@potassco.org"
2019-03-02 01:34:16 +01:00
echo "start of benchmark output of job $JOB_KEY" > test-output
2018-11-08 16:02:38 +01:00
sleep 10
start_time=$(date +%s%N)
2019-03-02 01:34:16 +01:00
echo "end of benchmark output of job $JOB_KEY" >> test-output
2018-11-08 16:02:38 +01:00
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
2019-03-02 00:53:57 +01:00
popd