From 767e85ad0dcb9bcb9637188062681311fabb3307 Mon Sep 17 00:00:00 2001 From: Tibor Frank Date: Tue, 3 Apr 2018 09:13:23 +0200 Subject: PAL Trending: download input files Change-Id: I407e3cdeb25547d46fafed702ee608f6c0e03091 Signed-off-by: Tibor Frank --- resources/tools/presentation/generator_CPTA.py | 2 +- resources/tools/presentation/input_data_files.py | 15 +++++++++++---- resources/tools/presentation/specification_CPTA.yaml | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) (limited to 'resources') diff --git a/resources/tools/presentation/generator_CPTA.py b/resources/tools/presentation/generator_CPTA.py index a1921fad9d..92244c2610 100644 --- a/resources/tools/presentation/generator_CPTA.py +++ b/resources/tools/presentation/generator_CPTA.py @@ -426,7 +426,7 @@ def _generate_all_charts(spec, input_data): # Generate the chart: period_name = "Daily" if period == 1 else \ "Weekly" if period < 20 else "Monthly" - chart["layout"]["title"] = chart["title"].format(period=period_name) + # chart["layout"]["title"] = chart["title"].format(period=period_name) _generate_chart(traces, chart["layout"], file_name="{0}-{1}-{2}{3}".format( diff --git a/resources/tools/presentation/input_data_files.py b/resources/tools/presentation/input_data_files.py index 7e19478570..439c0d88bd 100644 --- a/resources/tools/presentation/input_data_files.py +++ b/resources/tools/presentation/input_data_files.py @@ -37,7 +37,7 @@ CHUNK_SIZE = 512 # Separator used in file names SEPARATOR = "__" -REGEX_RELEASE = re.compile(r'(\D*)(\d{4})(\D*)') +REGEX_RELEASE = re.compile(r'(\D*)(\d{4}|master)(\D*)') def download_data_files(spec): @@ -81,6 +81,13 @@ def download_data_files(spec): try: response = get(url, stream=True) code = response.status_code + # temporary workaround, remove when output.log.xml is not needed + if code != codes["OK"] and \ + spec.input["file-name"].endswith(".gz"): + url = '.'.join(url.split('.')[:-1]) + ".log.gz" + response = get(url, stream=True) + code = response.status_code + if code != codes["OK"]: logging.warning( "Jenkins: {0}: {1}.".format(code, responses[code])) @@ -139,11 +146,11 @@ def download_data_files(spec): logging.info("{0}: {1}".format(code, responses[code])) elif spec.input["file-name"].endswith(".gz"): - rename(new_name, new_name[:-7]) - with open(new_name[:-7], 'r') as xml_file: + rename(new_name, new_name[:-3]) + with open(new_name[:-3], 'r') as xml_file: with gzip.open(new_name, 'wb') as gz_file: gz_file.write(xml_file.read()) - new_name = new_name[:-7] + new_name = new_name[:-3] status = "downloaded" logging.info("{0}: {1}".format(code, responses[code])) diff --git a/resources/tools/presentation/specification_CPTA.yaml b/resources/tools/presentation/specification_CPTA.yaml index 6101425783..6b5c7fad1f 100644 --- a/resources/tools/presentation/specification_CPTA.yaml +++ b/resources/tools/presentation/specification_CPTA.yaml @@ -179,7 +179,7 @@ - type: "input" # Ignored in debug mode general: - file-name: "output.xml.log.gz" + file-name: "output.xml.gz" file-format: ".gz" download-path: "{job}/{build}/archives/{filename}" extract: "output.xml" -- cgit 1.2.3-korg