diff --git a/scalpels/cli/actions/report.py b/scalpels/cli/actions/report.py index a61890c..ecbe8fe 100644 --- a/scalpels/cli/actions/report.py +++ b/scalpels/cli/actions/report.py @@ -30,8 +30,12 @@ def generate_result_html(result): t = lookup.get_template("line-chart.mako") print t.render(**result.__dict__) -def generate_multiple_result_html(result): - raise NotImplementedError("%s is not impl" % "generate_multiple_result_html") +def generate_multiple_result_html(results): + tmpl_dir = os.path.dirname(templates.__file__) + lookup = TemplateLookup(directories=[tmpl_dir]) + t = lookup.get_template("multi-line-chart.mako") + d = {"results": results} + print t.render(**d) def run(config): uuid = config.get("uuid") @@ -52,6 +56,11 @@ def run(config): print "command report: %s" % config print "task: <%s>" % task.uuid + rets = [] for ret_uuid in task.results: ret = db_api.result_get(ret_uuid) - pprint_result(ret) + rets.append(ret) + if config.get("html"): + generate_multiple_result_html(rets) + else: + map(pprint_result, rets) diff --git a/scalpels/cli/shell.py b/scalpels/cli/shell.py index d7ff9fd..02e6023 100755 --- a/scalpels/cli/shell.py +++ b/scalpels/cli/shell.py @@ -34,6 +34,7 @@ def main(): # setup report actions report = subparsers.add_parser("report") report.add_argument("--last", action="store_true", dest="last", help="report the last task") + report.add_argument("--html", action="store_true", dest="html", help="report html to stdout instead of pretty print") report.add_argument("uuid", type=str, default="", nargs="?", help="report the last task") # setup re-setup actions diff --git a/scalpels/templates/multi-line-chart.mako b/scalpels/templates/multi-line-chart.mako new file mode 100644 index 0000000..46309de --- /dev/null +++ b/scalpels/templates/multi-line-chart.mako @@ -0,0 +1,43 @@ + +
+ + + + + + % for ret in results: + + % endfor + + diff --git a/tests/ci/scalpels-ci.sh b/tests/ci/scalpels-ci.sh index 8a8299c..43671f6 100755 --- a/tests/ci/scalpels-ci.sh +++ b/tests/ci/scalpels-ci.sh @@ -32,5 +32,6 @@ sleep 120 sca stop for i in `sca result --list --short | tail -n2`; do - sca result $i --html > $BASE/logs/scalpels-test-$i.html + sca result $i --html > $BASE/logs/scalpels-result-$i.html done +sca report --html > $BASE/logs/scalpels-report.html