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

43 lines
886 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 02:34:02 +01:00
echo "start of benchmark output of job $JOB_KEY" > output
2019-03-02 02:32:28 +01:00
sleep "$TIME"
2019-03-02 02:35:57 +01:00
echo "collected $FRUIT" >> output
2018-11-08 16:02:38 +01:00
start_time=$(date +%s%N)
2019-03-02 02:34:02 +01:00
echo "end of benchmark output of job $JOB_KEY" >> output
git add output
2019-03-02 02:32:28 +01:00
git commit -m "Add results of job $JOB_KEY"
2018-11-08 16:02:38 +01:00
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