Skip to content

Commit

Permalink
Add support to run additional scripts after postprocessing
Browse files Browse the repository at this point in the history
This commit adds a --pbench_post flag in pbench_user_benchmark script.
It accepts a path to any script and runs it after postprocessing.
A sample use case would be run a binary which will add some files
in the result directory.
  • Loading branch information
chaitanyaenr authored and ndokos committed Mar 20, 2018
1 parent 54fcd46 commit a72c2f7
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion agent/bench-scripts/pbench-user-benchmark
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ function usage {
printf -- "\t\t --tool-group=str\n"
printf -- "\t\t --sysinfo=str, str = comma separated values of system information to be collected\n"
printf -- "\t\t available: $(pbench-collect-sysinfo --options)\n"
printf -- "\t\t --pbench_post=str path to the script which will be executed after postprocess\n"
}

# Process options and arguments
opts=$(getopt -q -o C:h --longoptions "config:,help,tool-group:,sysinfo:" -n "getopt.sh" -- "$@");
opts=$(getopt -q -o C:h --longoptions "config:,help,tool-group:,sysinfo:,pbench_post:" -n "getopt.sh" -- "$@");
if [ $? -ne 0 ]; then
printf -- "$*\n\n"
printf "\t${benchmark}: you specified an invalid option\n\n"
Expand Down Expand Up @@ -76,6 +77,13 @@ while true; do
shift
fi
;;
--pbench_post)
shift
if [ -n "$1" ]; then
pbench_post="$1"
shift
fi
;;
-h|--help)
usage
exit 0
Expand Down Expand Up @@ -151,8 +159,13 @@ if [[ $_PBENCH_BENCH_TESTS == 1 ]]; then
benchmark_duration=0
fi
$script_path/postprocess/user-benchmark-wrapper "$benchmark_run_dir" "$benchmark_duration"

pbench-stop-tools --group=$tool_group --iteration=$iteration --dir=$benchmark_results_dir
pbench-postprocess-tools --group=$tool_group --iteration=$iteration --dir=$benchmark_results_dir
pbench-metadata-log --group=$tool_group --dir=$benchmark_run_dir end
if [[ ! -z $pbench_post ]]; then
log "[$script_name]: Running $pbench_post"
$pbench_post
fi
pbench-collect-sysinfo --group=$tool_group --dir=$benchmark_run_dir --sysinfo=$sysinfo end
rmdir $benchmark_results_dir/.running

0 comments on commit a72c2f7

Please sign in to comment.