From: Nathan Cutler Date: Fri, 14 Sep 2018 10:40:55 +0000 (+0200) Subject: teuthology/task: implement dump_ctx internal task X-Git-Tag: 1.1.0~307^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=c6bdd1b7b34fa3b01b3000ff6f2b4d0adb22d332;p=teuthology.git teuthology/task: implement dump_ctx internal task This task is supposed to pretty-print the ctx and config parameters that are passed to each task. Signed-off-by: Nathan Cutler --- diff --git a/teuthology/task/dump_ctx.py b/teuthology/task/dump_ctx.py new file mode 100644 index 0000000000..f2da22e121 --- /dev/null +++ b/teuthology/task/dump_ctx.py @@ -0,0 +1,19 @@ +import logging +import pprint + +log = logging.getLogger(__name__) +pp = pprint.PrettyPrinter(indent=4) + +def _pprint_me(thing, prefix): + return prefix + "\n" + pp.pformat(thing) + +def task(ctx, config): + """ + Dump task context and config in teuthology log/output + + The intended use case is didactic - to provide an easy way for newbies, who + are working on teuthology tasks for the first time, to find out what + is inside the ctx and config variables that are passed to each task. + """ + log.info(_pprint_me(ctx, "Task context:")) + log.info(_pprint_me(config, "Task config:"))