On Thu, Mar 03, 2016 at 08:41:19PM +0100, Jan Tluka wrote:
This module provides functions that are related to PerfRepo.
Currently
contains just one function generate_perfrepo_comment() that returns
string containing various information such as kernel versions on the
hosts passed as argument, if running in Beaker environment the job url
and additional user specified string to be included in comment. This
function will be used in phase1/phase2 regression tests.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/RecipeCommon/PerfRepo.py | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
create mode 100644 lnst/RecipeCommon/PerfRepo.py
diff --git a/lnst/RecipeCommon/PerfRepo.py b/lnst/RecipeCommon/PerfRepo.py
new file mode 100644
index 0000000..608ea58
--- /dev/null
+++ b/lnst/RecipeCommon/PerfRepo.py
@@ -0,0 +1,43 @@
+"""
+This module defines helper functions for interacting with PerfRepo
+that can be imported directly into LNST Python tasks.
+
+Copyright 2016 Red Hat, Inc.
+Licensed under the GNU General Public License, version 2 as
+published by the Free Software Foundation; see COPYING for details.
+"""
+
+__author__ = """
+jtluka(a)redhat.com (Jan Tluka)
+"""
+
+import os
+
+
+'''
+Prepare the PerfRepo comment. By default it will include kernel versions
+used on the hosts and Beaker job url.
+
+hosts: list of HostAPI objects
+user_comment: additional user specified comment
+'''
Technically speaking, this doc string should start on the first line
after the header of the method/function it describes...
> +
> +def generate_perfrepo_comment(hosts=[], user_comment=None):
> + comment = ""
> +
> + for host in hosts:
> + host_cfg = host.get_configuration()
> + comment += "Kernel (%s): %s<BR>" % \
> + (host_cfg['id'], host_cfg['kernel_release'])
> +
> + # if we're running in Beaker environment, include job url
> + if 'BEAKER' in os.environ and 'JOBID' in os.environ:
> + bkr_server = os.environ['BEAKER']
> + bkr_jobid = os.environ['JOBID']
> + bkr_job_url = bkr_server + bkr_jobid
> + comment += "Beaker job: %s<BR>" % bkr_job_url
> +
> + if user_comment:
> + comment += user_comment
> +
> + return comment
> --
> 2.4.3
> _______________________________________________
> LNST-developers mailing list
> lnst-developers(a)lists.fedorahosted.org
>
https://lists.fedorahosted.org/admin/lists/lnst-developers@lists.fedoraho...