From 449ce711210813d235aa9856f9685eecfa0c3ae7 Mon Sep 17 00:00:00 2001
From: Maciej Szymanski <maszyman@cern.ch>
Date: Tue, 19 May 2020 11:27:24 +0200
Subject: [PATCH 1/2] revamp links added to dashboard

---
 collectRunResults.py | 81 +++++---------------------------------------
 1 file changed, 8 insertions(+), 73 deletions(-)

diff --git a/collectRunResults.py b/collectRunResults.py
index 8ac04d5e..3fce6a8d 100755
--- a/collectRunResults.py
+++ b/collectRunResults.py
@@ -366,80 +366,15 @@ def main():
                 id_ver = 0
 
                 # add to dictionary path to lhcbpr dashboard
-                try:
-                    active_applications = \
-                                          urlopen(
-                                              "https://lblhcbpr.cern.ch/api/active/applications/"
-                                          ).read()
-                    active_options = \
-                                     urlopen(
-                                         "https://lblhcbpr.cern.ch/api/options/"
-                                     ).read()
-                    versions_count = json.loads(urlopen("https://lblhcbpr.cern.ch/api/versions/").read())['count']
-                    active_versions = \
-                                      urlopen(
-                                          "https://lblhcbpr.cern.ch/api/versions/?page="+str(versions_count//10+1)
-                                      ).read()
-
-                    # getting the id of the project
-                    act_app = json.loads(active_applications)
-                    while True:
-                        for app in act_app['results']:
-                            if app['name'] == (options.app_name).upper():
-                                id_app = app['id']
-                                break
-                        if id_app > 0 or not act_app['next']:
-                            break
-                        act_app = json.loads(urlopen(act_app['next']).read())
-
-                    # getting the id of the test options
-                    act_opt = json.loads(active_options)
-                    while True:
-                        for opt in act_opt['results']:
-                            if opt['description'] == options.opt_name:
-                                id_opt = opt['id']
-                                break
-                        if id_opt > 0 or not act_opt['next']:
-                            break
-                        act_opt = json.loads(urlopen(act_opt['next']).read())
-
-                    # getting the id of the versions (nightlies are assumed)
-                    act_ver = json.loads(active_versions)
-                    while True:
-                        for version in act_ver['results']:
-                            if version['version'] == options.app_version and \
-                               version['application']['name'] == (options.app_name).upper():
-                                id_ver = version['id']
-                                break
-                        if id_ver > 0 or not act_ver['previous']:
-                            break
-                        act_ver = json.loads(urlopen(act_ver['previous']).read())
-
-                except Exception as ex:
-                    logger.warning('Problems with connection with LHCbPR api: %s', ex)
-
-                if options.app_name.startswith("Moore"):
-                    dataDict['lhcbpr_url'] = "https://lblhcbpr.cern.ch/#/app/hlt"
-                elif options.app_name == 'Brunel' and "upgradeprchecker" in options.opt_name.lower():
-                    dataDict['lhcbpr_url'] = "https://cern.ch/lhcbpr-hlt/PerfTests/UpgradeThroughput/PrChecker_"\
-                                             + options.app_version\
-                                             + "_"\
-                                             + str(options.platform)\
-                                             + "_"\
-                                             + options.startTime.replace(' ', '_')
-                elif options.app_name == 'Brunel' and "throughput" in options.handlers.lower():
-                    dataDict['lhcbpr_url'] = "https://cern.ch/lhcbpr-hlt/PerfTests/UpgradeThroughput/Throughput_"\
-                                             + options.app_version\
-                                             + "_"\
-                                             + str(options.opt_name)\
-                                             + "_"\
-                                             + str(options.platform)\
-                                             + "_"\
-                                             + options.startTime.replace(' ', '_')
+                if options.app_name.startswith("Moore") and "throughput" in options.handlers.lower():
+                    dataDict['lhcbpr_url'] = f"https://cern.ch/lhcbpr-hlt/"
+                                             f"PerfTests/UpgradeThroughput/"
+                                             f"Throughput_{options.app_version}_"
+                                             f"{str(options.opt_name)}_"
+                                             f"{str(options.platform)}_"
+                                             f"{options.startTime.replace(' ', '_')}"
                 else:
-                    # generic url to jobs module
-                    dataDict['lhcbpr_url'] = \
-                                             "https://lblhcbpr.cern.ch/#/app/jobs/list?apps={0}&options={1}&withNightly&nightlyVersionNumber=100&versions={2}".format(id_app, id_opt, id_ver)
+                    dataDict['lhcbpr_url'] = f"https://lblhcbpr.cern.ch/{options.app_name}"
 
     if options.send:
         try:
-- 
GitLab


From 3f3ecb287ba046d136c06ef59db417f51c1d747e Mon Sep 17 00:00:00 2001
From: Maciej Szymanski <maszyman@cern.ch>
Date: Tue, 19 May 2020 17:04:24 +0200
Subject: [PATCH 2/2] fix escaping

---
 collectRunResults.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/collectRunResults.py b/collectRunResults.py
index 3fce6a8d..87c05f7f 100755
--- a/collectRunResults.py
+++ b/collectRunResults.py
@@ -367,11 +367,11 @@ def main():
 
                 # add to dictionary path to lhcbpr dashboard
                 if options.app_name.startswith("Moore") and "throughput" in options.handlers.lower():
-                    dataDict['lhcbpr_url'] = f"https://cern.ch/lhcbpr-hlt/"
-                                             f"PerfTests/UpgradeThroughput/"
-                                             f"Throughput_{options.app_version}_"
-                                             f"{str(options.opt_name)}_"
-                                             f"{str(options.platform)}_"
+                    dataDict['lhcbpr_url'] = f"https://cern.ch/lhcbpr-hlt/" \
+                                             f"PerfTests/UpgradeThroughput/" \
+                                             f"Throughput_{options.app_version}_" \
+                                             f"{str(options.opt_name)}_" \
+                                             f"{str(options.platform)}_" \
                                              f"{options.startTime.replace(' ', '_')}"
                 else:
                     dataDict['lhcbpr_url'] = f"https://lblhcbpr.cern.ch/{options.app_name}"
-- 
GitLab