Make verification reporter pluggable

Some time ago we added new entity "exporters". For task we created a command
"rally task export" which allows to export task results to external systems.
Exporters can "easily" extende by plugins.

In case of verification component, proper command wasn't created yet. While I
thing idea of exporters is good enough, implementation can be improved.
To simplify usage, entity "exporters" was renamed to "reporters" and
integrated with "rally verify report" command. Generation of regular rally
reports (like html, json) is done in the same way as in plugabble reporters.

Proposed interface:

  rally verify report --uuid <uuid-1> [<uuid-2>...<uuid-n>] \
      --type <reporter-name> --to <destination>

Examples of usage:

  rally verify report --uuid some-uuid --type html --to /path/to/save

  # such exporter is not implemented yet, but we expect it soon
  rally verify report --uuids some-uuid --type elasticsearch \
      --to https://username@passwd:example.com

Change-Id: I4fb38984a73f92503bf2988e509477b10b308cac
This commit is contained in:
Andrey Kurilin
2017-01-09 03:50:20 +02:00
parent f8beab3b6c
commit 519763e6f1
2 changed files with 10 additions and 9 deletions

View File

@@ -54,7 +54,7 @@ _rally()
OPTS["verify_list-verifier-exts"]="--id"
OPTS["verify_list-verifier-tests"]="--id --pattern"
OPTS["verify_list-verifiers"]="--status"
OPTS["verify_report"]="--uuid --html --file --open"
OPTS["verify_report"]="--uuid --type --to --open"
OPTS["verify_rerun"]="--uuid --deployment-id --failed"
OPTS["verify_show"]="--uuid --sort-by --detailed"
OPTS["verify_start"]="--verifier-id --deployment-id --pattern --concurrency --load-list --skip-list --xfail-list --no-use"

View File

@@ -73,9 +73,8 @@ def call_rally(cmd, print_output=False, output_type=None):
if output_type:
data["output_file"] = data["stdout_file"].replace(
".txt.", ".%s." % output_type)
data["cmd"] += " --file %s" % data["output_file"]
if output_type == "html":
data["cmd"] += " --html"
data["cmd"] += " --to %s" % data["output_file"]
data["cmd"] += " --type %s" % output_type
try:
LOG.info("Try to execute `%s`." % data["cmd"])
@@ -113,8 +112,9 @@ def start_verification(args):
results["uuid"] = envutils.get_global(envutils.ENV_VERIFICATION)
results["show"] = call_rally("verify show")
results["show_detailed"] = call_rally("verify show --detailed")
for ot in ("json", "html"):
results[ot] = call_rally("verify report", output_type=ot)
for output_type in ("json", "html"):
results[output_type] = call_rally("verify report",
output_type=output_type)
# NOTE(andreykurilin): we need to clean verification uuid from global
# environment to be able to load it next time(for another verification).
envutils.clear_global(envutils.ENV_VERIFICATION)
@@ -132,9 +132,10 @@ def write_file(filename, data):
def generate_trends_reports(uuid_1, uuid_2):
"""Generate trends reports."""
results = {}
for ot in ("json", "html"):
results[ot] = call_rally(
"verify report --uuid %s %s" % (uuid_1, uuid_2), output_type=ot)
for output_type in ("json", "html"):
results[output_type] = call_rally(
"verify report --uuid %s %s" % (uuid_1, uuid_2),
output_type=output_type)
return results