From 3f84f33adcbd86e238ecc7be4bff7560951b5d84 Mon Sep 17 00:00:00 2001 From: Webb Scales Date: Fri, 14 Apr 2023 15:26:11 -0400 Subject: [PATCH] Retire the previous containerized Agent example from contrib and update the README.md. --- contrib/containerized-pbench/.gitignore | 2 - contrib/containerized-pbench/README.md | 27 +++++++---- .../containerized-pbench/example-driver.sh | 45 ------------------- .../containerized-pbench/example-workload.sh | 19 -------- contrib/containerized-pbench/gen-token.sh | 9 ---- contrib/containerized-pbench/mover.sh | 11 ----- contrib/containerized-pbench/pbench_demo | 12 ++--- contrib/containerized-pbench/setup.sh | 27 ----------- 8 files changed, 25 insertions(+), 127 deletions(-) delete mode 100755 contrib/containerized-pbench/example-driver.sh delete mode 100755 contrib/containerized-pbench/example-workload.sh delete mode 100755 contrib/containerized-pbench/gen-token.sh delete mode 100755 contrib/containerized-pbench/mover.sh mode change 100755 => 100644 contrib/containerized-pbench/pbench_demo delete mode 100755 contrib/containerized-pbench/setup.sh diff --git a/contrib/containerized-pbench/.gitignore b/contrib/containerized-pbench/.gitignore index 8fbb185f35..ad3cb3739f 100644 --- a/contrib/containerized-pbench/.gitignore +++ b/contrib/containerized-pbench/.gitignore @@ -1,3 +1 @@ fiotest -*.tmp -var_lib_pbench-agent diff --git a/contrib/containerized-pbench/README.md b/contrib/containerized-pbench/README.md index 3dfae2f383..bd4bc91993 100644 --- a/contrib/containerized-pbench/README.md +++ b/contrib/containerized-pbench/README.md @@ -1,10 +1,19 @@ # Running a Pbench Agent-driven Workload in a Container -1. Create a workload script (`example-workload.sh` can be used to start) - This script performs the invocation of a Pbench Agent workload driver, e.g. - `pbench-user-benchmark`, or `pbench-fio`, or `pbench-uperf`. -2. Setup the local execution environment to be aware of the target Pbench Server - `./setup.sh :` -3. Execute the workload - Typically this script performs the necessary setup required for the - containerized environment (`example-driver.sh` can be used to start, note - that it also moves the results to the Pbench Server). + +The Pbench Agent is available for use in a zero-installation scenario +via containerized execution. Agent containers are available from +[quay.io/pbench](https://quay.io/organization/pbench): there's a +repository for each distribution (e.g., +[pbench-agent-all-centos-9](https://quay.io/repository/pbench/pbench-agent-all-centos-9?tab=tags)) +with tags for each Agent release as well as for "hot builds" for +each development branch. + +The `pbench` script provided here is a wrapper which facilitates +the invocation of a Pbench Agent command using a containerized +deployment of the Pbench Agent. Simply prefix a Pbench Agent +command line with the path to this script to run it inside a +container, without needing to install the Agent on the host +system. (This is easily done by defining a shell alias for it.) + +The provided `pbench_demo` script shows the sequence of commands +which might be used to perform a `fio` benchmark run. \ No newline at end of file diff --git a/contrib/containerized-pbench/example-driver.sh b/contrib/containerized-pbench/example-driver.sh deleted file mode 100755 index 59e4bb5360..0000000000 --- a/contrib/containerized-pbench/example-driver.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -if [[ ! -f ./var_lib_pbench-agent/.token || ! -f ./pbench-agent.cfg.tmp ]]; then - echo "Please run ./setup.sh to properly setup the required environment." >&2 - exit 1 -fi - -# Create a `fiotest` directory to use as the target directory of the `fio` -# workload execution. -mkdir -p fiotest - -# Run the workload in the container. -# -# The `example-workload.sh` script is mounted into the container as -# `/workload.sh`, along with the target `fiotest` directory it requires, and the -# location of `/var/lib/pbench-agent`. This example relies on the CentOS 8 -# Pbench Agent "all" container image (which has everything and the kitchen sink -# installed). -# -# Notice that host networking is used for the container. -# -# NOTE that the container is not run with any privileges or adjusted namespaces -# so the tool data collected may not be what you expect. -podman run \ - --rm \ - --network host \ - --name example-workload \ - -v ${HOME}/.ssh:/root/.ssh:z \ - -v ./example-workload.sh:/workload.sh:z \ - -v ./var_lib_pbench-agent:/var/lib/pbench-agent:z \ - -v ./fiotest:/fiotest:z \ - quay.io/pbench/pbench-agent-all-centos-8:latest /workload.sh - -# Move the results to the target Pbench Server -# -# Note that we run the mover separately to demonstrate that the collected data -# is independent of the containerized environment in which it was collected. -podman run \ - -it \ - --rm \ - --network host \ - -v ./mover.sh:/mover.sh:z \ - -v ./pbench-agent.cfg.tmp:/opt/pbench-agent/config/pbench-agent.cfg:z \ - -v ./var_lib_pbench-agent:/var/lib/pbench-agent:z \ - quay.io/pbench/pbench-agent-all-centos-8:latest /mover.sh diff --git a/contrib/containerized-pbench/example-workload.sh b/contrib/containerized-pbench/example-workload.sh deleted file mode 100755 index 6f8fb1e971..0000000000 --- a/contrib/containerized-pbench/example-workload.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# An example of how to run a simple workload with `pbench-user-benchmark` - -# In a containerized environment, the Pbench Agent profile must be run to -# establish the proper execution environment. -source /opt/pbench-agent/profile - -# The set of tools the user desires to run must be registered before the -# workload is executed. -echo "Registering the 'heavy' tool set provided by the Pbench Agent" -pbench-register-tool-set heavy - -# The `user-benchmark` workload wrapper simply takes a configuration name, in -# this case the very generic `example-workload`, followed by the command to use -# to run the workload. Note that the command is separated by `--` to avoid -# any workload command line arguments that follow from being interpreted as -# options to `pbench-user-benchmark` command itself. -echo "Executing pbench-user-benchmark ..." -pbench-user-benchmark --config example-workload -- fio --directory=/fiotest --name fio_test_file --direct=1 --rw=randread --bs=16k --size=100M --numjobs=16 --time_based --runtime=20s --group_reporting --norandommap diff --git a/contrib/containerized-pbench/gen-token.sh b/contrib/containerized-pbench/gen-token.sh deleted file mode 100755 index 67bdd0b020..0000000000 --- a/contrib/containerized-pbench/gen-token.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -# In a containerized environment, the Pbench Agent profile must be run to -# establish the proper execution environment. -source /opt/pbench-agent/profile - -# Generate a token to move results to the target Pbench Server storing it in the -# mounted /var/lib/pbench-agent directory. -pbench-generate-token --output=/var/lib/pbench-agent/.token diff --git a/contrib/containerized-pbench/mover.sh b/contrib/containerized-pbench/mover.sh deleted file mode 100755 index bf75292f61..0000000000 --- a/contrib/containerized-pbench/mover.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -# In a containerized environment, the Pbench Agent profile must be run to -# establish the proper execution environment. -source /opt/pbench-agent/profile - -# Move the results to the configured Pbench Server. -# -# NOTE: the required token must be provided in the file -# /var/lib/pbench-agent/.token ahead of time. -pbench-results-move --token=$(:) to move the results to as the first argument." >&2 - exit 2 -fi -cat > ./pbench-agent.cfg.tmp <<- EOF - [DEFAULT] - pbench_install_dir = /opt/pbench-agent - pbench_web_server = ${1} - [config] - path = %(pbench_install_dir)s/config - files = pbench-agent-default.cfg - EOF - -# Create a directory to use as the `/var/lib/pbench-agent` directory mounted -# in the container. -mkdir -p var_lib_pbench-agent - -podman run \ - -it \ - --rm \ - --network host \ - -v ./gen-token.sh:/gen-token.sh:z \ - -v ./pbench-agent.cfg.tmp:/opt/pbench-agent/config/pbench-agent.cfg:z \ - -v ./var_lib_pbench-agent:/var/lib/pbench-agent:z \ - quay.io/pbench/pbench-agent-all-centos-8:latest /gen-token.sh