From 878795518811bd59fa2b221b98c25fd0170f8b00 Mon Sep 17 00:00:00 2001 From: Graham Whaley Date: Fri, 23 Aug 2019 14:30:50 +0100 Subject: [PATCH] metrics: report: generate PNGs alongside the pdf To aid in incorporating the results graphs and tables into other documents, generate PNG files of the tables and plots alongside the full PDF report, and place them in the output directory. Achieve this by processing an html as well as a pdf targetted output document, and grabbing the png's generated from that operation. Signed-off-by: Graham Whaley --- metrics/report/report_dockerfile/genreport.sh | 11 ++++++--- metrics/report/report_dockerfile/html.Rmd | 23 +++++++++++++++++++ .../report_dockerfile/metrics_report.Rmd | 20 +++------------- metrics/report/report_dockerfile/pdf.Rmd | 23 +++++++++++++++++++ 4 files changed, 57 insertions(+), 20 deletions(-) create mode 100644 metrics/report/report_dockerfile/html.Rmd create mode 100644 metrics/report/report_dockerfile/pdf.Rmd diff --git a/metrics/report/report_dockerfile/genreport.sh b/metrics/report/report_dockerfile/genreport.sh index c27379b..8454558 100755 --- a/metrics/report/report_dockerfile/genreport.sh +++ b/metrics/report/report_dockerfile/genreport.sh @@ -7,8 +7,13 @@ REPORTNAME="metrics_report.pdf" cd scripts -Rscript --slave -e "library(knitr);knit('metrics_report.Rmd')" -Rscript --slave -e "library(knitr);pandoc('metrics_report.md', format='latex')" +Rscript --slave -e "library(knitr);knit('pdf.Rmd')" +Rscript --slave -e "library(knitr);pandoc('pdf.md', format='latex')" -cp /scripts/${REPORTNAME} /outputdir +Rscript --slave -e "library(knitr);knit('html.Rmd')" +Rscript --slave -e "library(knitr);pandoc('html.md', format='html')" + +cp /scripts/pdf.pdf /outputdir/${REPORTNAME} +cp /scripts/figure/*.png /outputdir/ +echo "PNGs of graphs and tables can be found in the output directory." echo "The report, named ${REPORTNAME}, can be found in the output directory" diff --git a/metrics/report/report_dockerfile/html.Rmd b/metrics/report/report_dockerfile/html.Rmd new file mode 100644 index 0000000..0e9d36d --- /dev/null +++ b/metrics/report/report_dockerfile/html.Rmd @@ -0,0 +1,23 @@ +--- +# Copyright (c) 2018-2019 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 +# +title: "Kubernetes metrics report" +author: "Auto generated" +date: "`r format(Sys.time(), '%d %B, %Y')`" +output: + html_document: +urlcolor: blue +--- + +```{r setup, include=FALSE} +#Set these opts to get pdf images which fit into beamer slides better +opts_chunk$set(dev = 'png') +# Pick up any env set by the invoking script, such as the root dir of the +# results data tree +source("/inputdir/Env.R") +``` + +```{r child = 'metrics_report.Rmd'} +``` diff --git a/metrics/report/report_dockerfile/metrics_report.Rmd b/metrics/report/report_dockerfile/metrics_report.Rmd index d9212c2..28599b1 100644 --- a/metrics/report/report_dockerfile/metrics_report.Rmd +++ b/metrics/report/report_dockerfile/metrics_report.Rmd @@ -3,21 +3,7 @@ # # SPDX-License-Identifier: Apache-2.0 # -title: "Kubernetes metrics report" -author: "Auto generated" -date: "`r format(Sys.time(), '%d %B, %Y')`" -output: - pdf_document: -urlcolor: blue --- - -```{r setup, include=FALSE} -#Set these opts to get pdf images which fit into beamer slides better -opts_chunk$set(dev = 'pdf') -# Pick up any env set by the invoking script, such as the root dir of the -# results data tree -source("/inputdir/Env.R") -``` \pagebreak # Introduction @@ -35,7 +21,7 @@ and more idle `busybox` pods on a single node Kubernetes cluster. > Note: CPU % is measured as a system whole - 100% represents *all* CPUs on the node. -```{r, echo=FALSE, fig.cap="K8S scaling", results='asis'} +```{r scaling, echo=FALSE, fig.cap="K8S scaling", results='asis'} source('tidy_scaling.R') ``` @@ -46,7 +32,7 @@ This [test](https://github.com/clearlinux/cloud-native-setup/metrics/scaling/k8s measures the time taken to launch and delete pods in parallel using a deployment. The times are how long it takes for the whole deployment operation to complete. -```{r, echo=FALSE, fig.cap="K8S parallel pods"} +```{r parallel, echo=FALSE, fig.cap="K8S parallel pods"} source('parallel.R') ``` @@ -58,6 +44,6 @@ This table describes the test system details, as derived from the information co in the test results files. -```{r, echo=FALSE, fig.cap="System configuration details"} +```{r dut, echo=FALSE, fig.cap="System configuration details"} source('dut-details.R') ``` diff --git a/metrics/report/report_dockerfile/pdf.Rmd b/metrics/report/report_dockerfile/pdf.Rmd new file mode 100644 index 0000000..d07e1f3 --- /dev/null +++ b/metrics/report/report_dockerfile/pdf.Rmd @@ -0,0 +1,23 @@ +--- +# Copyright (c) 2018-2019 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 +# +title: "Kubernetes metrics report" +author: "Auto generated" +date: "`r format(Sys.time(), '%d %B, %Y')`" +output: + pdf_document: +urlcolor: blue +--- + +```{r setup, include=FALSE} +#Set these opts to get pdf images which fit into beamer slides better +opts_chunk$set(dev = 'pdf') +# Pick up any env set by the invoking script, such as the root dir of the +# results data tree +source("/inputdir/Env.R") +``` + +```{r child = 'metrics_report.Rmd'} +```