aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/presentation/specification_parser.py
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2020-04-23 08:30:33 +0200
committerTibor Frank <tifrank@cisco.com>2020-04-24 04:36:40 +0000
commit1945ebc5fe96f2289c6ffc4cc162daa1d3b8658f (patch)
tree3b64a16d6a59ac950f1c3ad14f0a70b98c3b14cb /resources/tools/presentation/specification_parser.py
parent0e8a09b2ab237b8107f4e60b983fc6191118bb1c (diff)
PAL: Reverse download order for trending
Change-Id: Idd6bf8b89ce0fb5ebf9734b39a8f6058861b8ec5 Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/tools/presentation/specification_parser.py')
-rw-r--r--resources/tools/presentation/specification_parser.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/resources/tools/presentation/specification_parser.py b/resources/tools/presentation/specification_parser.py
index 61ef42ef8d..548bbff532 100644
--- a/resources/tools/presentation/specification_parser.py
+++ b/resources/tools/presentation/specification_parser.py
@@ -528,14 +528,15 @@ class Specification:
continue
if isinstance(builds, dict):
build_end = builds.get(u"end", None)
+ max_builds = builds.get(u"max-builds", None)
try:
build_end = int(build_end)
except ValueError:
# defined as a range <start, build_type>
build_end = self._get_build_number(job, build_end)
- builds = [x for x in range(builds[u"start"],
- build_end + 1)
- if x not in builds.get(u"skip", list())]
+ builds = [x for x in range(builds[u"start"], build_end + 1)]
+ if max_builds and max_builds < len(builds):
+ builds = builds[:max_builds]
self.configuration[u"data-sets"][set_name][job] = builds
elif isinstance(builds, list):
for idx, item in enumerate(builds):
@@ -590,14 +591,23 @@ class Specification:
if builds:
if isinstance(builds, dict):
build_end = builds.get(u"end", None)
+ max_builds = builds.get(u"max-builds", None)
+ reverse = bool(builds.get(u"reverse", False))
try:
build_end = int(build_end)
except ValueError:
# defined as a range <start, build_type>
+ if build_end in (u"lastCompletedBuild",
+ u"lastSuccessfulBuild"):
+ reverse = True
build_end = self._get_build_number(job, build_end)
builds = [x for x in range(builds[u"start"],
build_end + 1)
if x not in builds.get(u"skip", list())]
+ if reverse:
+ builds.reverse()
+ if max_builds and max_builds < len(builds):
+ builds = builds[:max_builds]
self._specification[u"input"][u"builds"][job] = list()
for build in builds:
self._specification[u"input"][u"builds"][job]. \
@@ -608,6 +618,7 @@ class Specification:
f"No build is defined for the job {job}. Trying to "
f"continue without it."
)
+
except KeyError:
raise PresentationError(u"No data to process.")