Skip to content

Commit c7d40b7

Browse files
committed
Remove redundancy in pbench-fio operations
We now generate the `$benchmark_run_dir/fio-client.file` once and then use that one file in all the `fio --client-file=` invocations. We now generate the `fio.job` file once per iteration, instead of for each sample (this makes it easier to wade through unit test output to see if the behaviors are correct). We have simplified the handling of `--postprocess-only` to reduce the number of times it is checked in various parts of the code. Using `--install` and `--postprocess-only=y` is incompatible, so we now issue a message, post the `usage`, and exit with an error. We now post the `usage` message when exiting for `-c`|`--clients` and `--client-file` incompatibilities. We also obsolete the --remote-only option since it was unused. We only create the `.iterations` file in the `$pbench_tmp` directory if we are going to proceed with a run (even for `--postprocess-only=y`).
1 parent 3dc8ea0 commit c7d40b7

File tree

10 files changed

+388
-1413
lines changed

10 files changed

+388
-1413
lines changed

agent/bench-scripts/gold/pbench-fio/test-04.txt

Lines changed: 119 additions & 719 deletions
Large diffs are not rendered by default.

agent/bench-scripts/gold/pbench-fio/test-05.txt

Lines changed: 17 additions & 20 deletions
Large diffs are not rendered by default.

agent/bench-scripts/gold/pbench-fio/test-06.txt

Lines changed: 18 additions & 21 deletions
Large diffs are not rendered by default.

agent/bench-scripts/gold/pbench-fio/test-07.txt

Lines changed: 20 additions & 149 deletions
Large diffs are not rendered by default.

agent/bench-scripts/gold/pbench-fio/test-08.txt

Lines changed: 20 additions & 121 deletions
Large diffs are not rendered by default.

agent/bench-scripts/gold/pbench-fio/test-13.txt

Lines changed: 76 additions & 275 deletions
Large diffs are not rendered by default.

agent/bench-scripts/gold/pbench-fio/test-20.txt

Lines changed: 18 additions & 21 deletions
Large diffs are not rendered by default.

agent/bench-scripts/gold/test-benchmark-clis/test-CL.txt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,6 @@ The following options are available:
234234
--install
235235
install only (default is False)
236236

237-
--remote-only
238-
run this on the remotes only
239-
240237
--histogram-interval-sec=<int>
241238
set the histogram logging interval in seconds (default 10)
242239

@@ -326,9 +323,6 @@ The following options are available:
326323
--install
327324
install only (default is False)
328325

329-
--remote-only
330-
run this on the remotes only
331-
332326
--histogram-interval-sec=<int>
333327
set the histogram logging interval in seconds (default 10)
334328

@@ -420,9 +414,6 @@ The following options are available:
420414
--install
421415
install only (default is False)
422416

423-
--remote-only
424-
run this on the remotes only
425-
426417
--histogram-interval-sec=<int>
427418
set the histogram logging interval in seconds (default 10)
428419

agent/bench-scripts/pbench-fio

Lines changed: 99 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ job_file="${script_path}/templates/fio.job"
3131
# 2) ensure the right version of the benchmark is installed
3232
# 3) gather pre-run state
3333
# 4) run the benchmark and start/stop perf analysis tools
34-
# 5) gather post-run state
35-
# 6) postprocess benchmark data
36-
# 7) postprocess analysis tool data
34+
# 5) postprocess analysis tool data
35+
# 6) gather post-run state
36+
# 7) postprocess benchmark data
3737

3838
orig_cmd="$*"
3939

@@ -46,7 +46,6 @@ maxstddevpct=5 # maximum allowable standard deviation in percent
4646
max_failures=6 # after N failed attempts to hit below $maxstddevpct, move on to the nest test
4747
supported_test_types="read,write,rw,randread,randwrite,randrw"
4848
install_only="n"
49-
remote_only="n"
5049
config=""
5150
rate_iops=""
5251
test_types="read,randread" # default is -non- destructive
@@ -155,9 +154,6 @@ function usage {
155154
printf -- "\t--install\n"
156155
printf "\t\tinstall only (default is False)\n"
157156
printf "\n"
158-
printf -- "\t--remote-only\n"
159-
printf "\t\trun this on the remotes only\n"
160-
printf "\n"
161157
printf -- "\t--histogram-interval-sec=<int>\n"
162158
printf "\t\tset the histogram logging interval in seconds (default $histogram_interval_sec)\n"
163159
printf "\n"
@@ -183,11 +179,18 @@ function fio_process_options() {
183179
;;
184180
--install)
185181
shift;
182+
if [[ "$postprocess_only" != "n" ]]; then
183+
printf -- "${script_name} $*\n"
184+
printf -- "\n"
185+
printf -- "\t--install not compatible with specified \"--postprocess-only ${postprocess_only}\" option\n\n"
186+
usage
187+
exit 1
188+
fi
186189
install_only="y"
187190
;;
188191
--remote-only)
189192
shift;
190-
remote_only="y"
193+
warn_log "--remote-only is deprecated, ignoring (was non-operational previously)"
191194
;;
192195
--max-stddev)
193196
shift;
@@ -269,7 +272,10 @@ function fio_process_options() {
269272
-c|--clients)
270273
shift;
271274
if [ ! -z "$client_file" ] ;then
272-
printf "--clients and --client-file are mutually exclusive"
275+
printf -- "${script_name} $*\n"
276+
printf -- "\n"
277+
printf -- "\t-c|--clients and --client-file are mutually exclusive\n\n"
278+
usage
273279
exit 1
274280
fi
275281
if [ -n "$1" ]; then
@@ -280,7 +286,10 @@ function fio_process_options() {
280286
--client-file)
281287
shift;
282288
if [ ! -z "$clients" ] ;then
283-
printf "--clients and --client-file are mutually exclusive"
289+
printf -- "${script_name} $*\n"
290+
printf -- "\n"
291+
printf -- "\t-c|--clients and --client-file are mutually exclusive\n\n"
292+
usage
284293
exit 1
285294
fi
286295
if [ -n "$1" ]; then
@@ -293,6 +302,7 @@ function fio_process_options() {
293302
while read line; do
294303
clients="$clients,$line"
295304
done <$1
305+
# Remove the leading comma since $clients starts off empty
296306
clients=`echo $clients | sed -e 's/^,//'`
297307
fi
298308
shift;
@@ -345,6 +355,13 @@ function fio_process_options() {
345355
if [ -n "$1" ]; then
346356
postprocess_only="$1"
347357
shift;
358+
if [[ "$postprocess_only" != "n" && "$install_only" == "y" ]]; then
359+
printf -- "${script_name} $*\n"
360+
printf -- "\n"
361+
printf -- "\t\"--postprocess-only ${postprocess_only}\" not compatible with specified --install option\n\n"
362+
usage
363+
exit 1
364+
fi
348365
fi
349366
;;
350367
--run-dir)
@@ -423,8 +440,6 @@ function fio_process_options() {
423440
benchmark_fullname="$(basename $run_dir)"
424441
benchmark_run_dir="$run_dir"
425442
fi
426-
benchmark_iterations="$pbench_tmp/${benchmark_fullname}.iterations"
427-
> ${benchmark_iterations}
428443
}
429444

430445
function record_iteration {
@@ -443,20 +458,19 @@ function record_iteration {
443458

444459
# Ensure the right version of the benchmark is installed
445460
function fio_install() {
446-
if [ "$postprocess_only" = "n" ]; then
447-
if check_install_rpm $benchmark_rpm $ver; then
448-
debug_log "[$script_name]$benchmark_rpm $ver is installed"
449-
else
450-
debug_log "[$script_name]$benchmark_rpm $ver installation failed, exiting"
451-
exit 1
452-
fi
461+
if check_install_rpm $benchmark_rpm $ver; then
462+
debug_log "[$script_name]$benchmark_rpm $ver is installed"
463+
else
464+
debug_log "[$script_name]$benchmark_rpm $ver installation failed, exiting"
465+
exit 1
453466
fi
454467
if [ ! -z "$clients" ] ; then
455468
debug_log "verifying clients have fio installed"
456469
echo "verifying clients have fio installed"
457470
for client in `echo $clients | sed -e s/,/" "/g`; do
458-
ssh $ssh_opts $client ${pbench_install_dir}/bench-scripts/$script_name --remote-only --install &
471+
ssh $ssh_opts $client ${pbench_install_dir}/bench-scripts/$script_name --install &
459472
done
473+
# FIXME - save the pid and wait for each pid to ensure it returns with success
460474
wait
461475
fi
462476
}
@@ -468,26 +482,24 @@ function fio_device_check() {
468482
local dev=""
469483
local client=""
470484
local rc=0
471-
if [ "$postprocess_only" = "n" ]; then
472-
debug_log "fio_device_check() $devs $clients"
473-
for dev in `echo $devs | sed -e s/,/" "/g`; do
474-
if echo $dev | grep -q "^/dev/"; then
475-
if [ ! -z "$clients" ]; then
476-
for client in `echo $clients | sed -e s/,/" "/g`; do
477-
debug_log "checking to see if $dev exists on client $client"
478-
ssh $ssh_opts $client "if [ -L $dev ]; then dev=`dirname $dev`/`readlink $dev`; fi; test -b $dev" || rc=1
479-
done
480-
wait
481-
else
482-
if [ -L $dev ]; then dev=`dirname $dev`/`readlink $dev`; fi; test -b $dev || rc=1
483-
fi
484-
if [ $rc -eq 1 ]; then
485-
error_log "At least one client did not have block device $dev, exiting"
486-
exit 1
487-
fi
485+
486+
debug_log "fio_device_check() $devs $clients"
487+
for dev in `echo $devs | sed -e s/,/" "/g`; do
488+
if echo $dev | grep -q "^/dev/"; then
489+
if [ ! -z "$clients" ]; then
490+
for client in `echo $clients | sed -e s/,/" "/g`; do
491+
debug_log "checking to see if $dev exists on client $client"
492+
ssh $ssh_opts $client "if [ -L $dev ]; then dev=`dirname $dev`/`readlink $dev`; fi; test -b $dev" || rc=1
493+
done
494+
else
495+
if [ -L $dev ]; then dev=`dirname $dev`/`readlink $dev`; fi; test -b $dev || rc=1
488496
fi
489-
done
490-
fi
497+
if [ $rc -eq 1 ]; then
498+
error_log "At least one client did not have block device $dev, exiting"
499+
exit 1
500+
fi
501+
fi
502+
done
491503
}
492504

493505
function fio_create_jobfile() {
@@ -548,7 +560,7 @@ function fio_run_job() {
548560
exit 1
549561
fi
550562

551-
echo "running fio job: $fio_job_file"
563+
echo "running fio job: $fio_job_file ($(basename $benchmark_results_dir))"
552564

553565
if [ ! -z "$clients" ]; then
554566
debug_log "creating directories on the clients"
@@ -585,10 +597,9 @@ function fio_run_job() {
585597

586598
local client_opts=""
587599

588-
# if a client-file parameter was passed, then clients is already
589-
# initialized to its contents
590-
591600
if [ ! -z "$clients" ]; then
601+
# If a client-file parameter was passed, then clients is
602+
# already initialized to its contents.
592603
local max_jobs=0
593604
local nclients=0
594605

@@ -602,17 +613,9 @@ function fio_run_job() {
602613
done
603614
fi
604615

605-
# make the fio command shorter by always using a client file
606-
# regardless of how clients were specified
607-
# we always save the client list in the benchmark results directory
608-
609-
client_file=$benchmark_results_dir/pbench-clients.list
610-
for client in `echo $clients | sed -e s/,/" "/g`; do
611-
echo $client
612-
done > $client_file
613-
let nclients=`wc -l < $client_file`
616+
let nclients=`wc -l < $_client_file`
614617
let max_jobs=$max_jobs*$nclients
615-
client_opts="$client_opts --client=$client_file --max-jobs=$max_jobs"
618+
client_opts="$client_opts --client=$_client_file --max-jobs=$max_jobs"
616619
fi
617620

618621
# Certain test preparation steps such as cache dropping can be a bit
@@ -683,6 +686,26 @@ function fio_run_job() {
683686
# Run the benchmark and start/stop perf analysis tools
684687
function fio_run_benchmark() {
685688
(( histogram_interval_msec = histogram_interval_sec * 1000 ))
689+
690+
if [[ ! -z "$client_file" ]] ;then
691+
# Copy the clients file given on the command line into the run
692+
# directory to keep it with the run.
693+
cp $client_file $benchmark_run_dir/fio-client.file
694+
_client_file=$benchmark_run_dir/fio-client.file
695+
else
696+
if [[ ! -z "$clients" ]]; then
697+
# Record the -c|--clients list into the
698+
# fio-client.file. This makes the fio command shorter
699+
# by always using a client file regardless of how
700+
# clients were specified. We only need to save the
701+
# client list once in the benchmark run directory.
702+
_client_file=$benchmark_run_dir/fio-client.file
703+
for client in `echo $clients | sed -e s/,/" "/g`; do
704+
echo $client
705+
done > $_client_file
706+
fi
707+
fi
708+
686709
local count=1
687710
if [ "$job_mode" = "serial" ]; then
688711
# if each target is separated by a space, there will be one job for each in next for loop
@@ -730,25 +753,26 @@ function fio_run_benchmark() {
730753
fi
731754
fi
732755
if [ -e $iteration_dir ]; then
756+
fio_job_file="$iteration_dir/fio.job"
757+
# ARG 1 2 3 4 5 6 7 8 9 10 11 12 13 14
758+
fio_create_jobfile "$test_type" "$ioengine" "$block_size" "$iodepth" "$direct" "$sync" "$runtime" "$ramptime" "$file_size" "$rate_iops" "$histogram_interval_msec" "$dev" "$fio_job_file" "$numjobs"
759+
if [ "$job_mode" = "serial" ]; then
760+
dev_short_name="`basename $dev`"
761+
# easier to identify what job used what device when having 1 job per device
762+
iteration="$iteration-${dev_short_name}"
763+
fi
733764
iteration_failed=0
734-
# each attempt at a test config requires multiple samples to get stddev
735765
sample_failed=0
736766
for sample in `seq 1 $nr_samples`; do
737-
if [ "$job_mode" = "serial" ]; then
738-
dev_short_name="`basename $dev`"
739-
# easier to identify what job used what device when having 1 job per device
740-
iteration="$iteration-${dev_short_name}"
741-
fi
767+
# each attempt at a test config requires multiple samples to get stddev
742768
benchmark_results_dir="$iteration_dir/sample$sample"
743769
benchmark_tools_dir="$benchmark_results_dir/tools-$tool_group"
744770
if [ "$postprocess_only" = "n" ]; then
745771
if [ -e $benchmark_results_dir ]; then
772+
# FIXME - Shouldn't we error and exit out instead of removing data?
746773
/bin/rm -rf $benchmark_results_dir
747774
fi
748775
mkdir -p $benchmark_results_dir
749-
fio_job_file="$benchmark_results_dir/fio.job"
750-
# ARG 1 2 3 4 5 6 7 8 9 10 11 12 13 14
751-
fio_create_jobfile "$test_type" "$ioengine" "$block_size" "$iodepth" "$direct" "$sync" "$runtime" "$ramptime" "$file_size" "$rate_iops" "$histogram_interval_msec" "$dev" "$fio_job_file" "$numjobs"
752776
fio_run_job "$iteration" "$benchmark_results_dir" "$fio_job_file" "$dev" "$clients"
753777
else
754778
# if we are only postprocessing, then we might have to untar an existing result
@@ -793,26 +817,24 @@ function fio_run_benchmark() {
793817
done
794818
done
795819
done
796-
797-
if [ ! -z "$client_file" ] ;then
798-
cp $client_file $benchmark_run_dir/fio-client.file
799-
fi
800820
}
801821

802822
fio_process_options "$@"
803-
fio_install
804-
805-
if [ "$install_only" = "y" ]; then
806-
exit 0
823+
if [ "$postprocess_only" = "n" ]; then
824+
fio_install
825+
if [ "$install_only" = "y" ]; then
826+
exit 0
827+
fi
828+
fio_device_check "$targets" "$clients"
829+
mkdir -p $benchmark_run_dir/.running
830+
if [[ $? -ne 0 ]]; then
831+
error_log "Unable to create $benchmark_run_dir path and/or .running marker directory"
832+
exit 1
833+
fi
807834
fi
808835

809-
fio_device_check "$targets" "$clients"
810-
811-
mkdir -p $benchmark_run_dir/.running
812-
if [[ $? -ne 0 ]]; then
813-
error_log "Unable to create $benchmark_run_dir path and/or .running marker directory"
814-
exit 1
815-
fi
836+
benchmark_iterations="$pbench_tmp/${benchmark_fullname}.iterations"
837+
> ${benchmark_iterations}
816838

817839
export benchmark config
818840
pbench-collect-sysinfo --group=$tool_group --dir=$benchmark_run_dir --sysinfo=$sysinfo beg

agent/bench-scripts/unittests

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ declare -A rundirs=(
240240
[test-06]="fio_test-06_$date"
241241
[test-07]="fio_test-07_$date"
242242
[test-08]="fio_test-08_$date"
243-
[test-13]="fio_test-08_$date"
243+
[test-13]="fio_test-13_$date"
244244
[test-20]="fio_test-20_$date"
245245
[test-22]="trafficgen_test-22_$date"
246246
)

0 commit comments

Comments
 (0)