From 9efe8229918b1a214fdba290492ef684f8ddd24c Mon Sep 17 00:00:00 2001 From: liyingjun Date: Wed, 23 Sep 2015 09:29:57 +0800 Subject: [PATCH] Add "description" to task config Fetch "description" from scenario doc string if no user specified description then add it to the task config. String "description" property will be added to the config. Partial-bug: #1447496 Co-Authored-By: Andrey Kurilin Change-Id: I882938e86d6c8209b669d7220285e8aa05bdd3e3 --- rally-jobs/rally.yaml | 7 +++++++ rally/common/db/sqlalchemy/api.py | 2 ++ rally/task/engine.py | 14 ++++++++++++++ rally/task/processing/plot.py | 1 + rally/ui/templates/task/report.html | 3 +++ tests/unit/common/db/test_api.py | 16 ++++++++++++++-- tests/unit/task/processing/test_plot.py | 7 ++++--- tests/unit/task/test_engine.py | 16 +++++++++++----- 8 files changed, 56 insertions(+), 10 deletions(-) diff --git a/rally-jobs/rally.yaml b/rally-jobs/rally.yaml index 15ea21582c..81efe58abc 100644 --- a/rally-jobs/rally.yaml +++ b/rally-jobs/rally.yaml @@ -298,6 +298,7 @@ max_degradation: 50 - + description: "Check 'constant' runner." args: sleep: 0.25 runner: @@ -310,6 +311,7 @@ max: 0 - + description: "Check 'constant_for_duration' runner." args: sleep: 0.1 runner: @@ -321,6 +323,7 @@ max: 0 - + description: "Check 'rps' runner." args: sleep: 0.001 runner: @@ -332,6 +335,7 @@ max: 0 - + description: "Check 'rps' runner with float value of requests per second." args: sleep: 0.1 runner: @@ -354,6 +358,7 @@ max: 0 - + description: "Check 'max_concurrency' and 'max_cpu_count' properties of 'rps' runner." args: sleep: 0.001 runner: @@ -367,6 +372,7 @@ max: 0 - + description: "Check 'serial' runner." args: sleep: 0.1 runner: @@ -390,6 +396,7 @@ failure_rate: max: 0 - + description: "Check 'quotas' context." args: sleep: 0.01 runner: diff --git a/rally/common/db/sqlalchemy/api.py b/rally/common/db/sqlalchemy/api.py index 42c9186897..e3cd9db7ce 100644 --- a/rally/common/db/sqlalchemy/api.py +++ b/rally/common/db/sqlalchemy/api.py @@ -229,6 +229,7 @@ class Connection(object): "updated_at": workload.updated_at, "key": { "name": workload.name, + "description": workload.description, "pos": workload.position, "kw": { "args": workload.args, @@ -420,6 +421,7 @@ class Connection(object): subtask_uuid=subtask_uuid) workload.update({ "name": key["name"], + "description": key["description"], "position": key["pos"], "runner": key["kw"]["runner"], "runner_type": key["kw"]["runner"]["type"], diff --git a/rally/task/engine.py b/rally/task/engine.py index 5a67f0ef21..2d01b1b79c 100644 --- a/rally/task/engine.py +++ b/rally/task/engine.py @@ -491,6 +491,9 @@ class TaskConfig(object): "type": "object", "properties": { "args": {"type": "object"}, + "description": { + "type": "string" + }, "runner": { "type": "object", "properties": {"type": {"type": "string"}}, @@ -544,6 +547,7 @@ class TaskConfig(object): "type": "object", "properties": { "name": {"type": "string"}, + "description": {"type": "string"}, "args": {"type": "object"}, "runner": { @@ -664,6 +668,15 @@ class Workload(object): """ def __init__(self, config, pos): self.name = config["name"] + self.description = config.get("description", "") + if not self.description: + try: + self.description = scenario.Scenario.get( + self.name).get_info()["title"] + except (exceptions.PluginNotFound, + exceptions.MultipleMatchesFound): + # let's fail an issue with loading plugin at a validation step + pass self.runner = config.get("runner", {}) self.sla = config.get("sla", {}) self.hooks = config.get("hooks", []) @@ -702,6 +715,7 @@ class Workload(object): def make_key(self): return {"name": self.name, + "description": self.description, "pos": self.pos, "kw": self.to_task()} diff --git a/rally/task/processing/plot.py b/rally/task/processing/plot.py index 4690ecce58..83a244e643 100644 --- a/rally/task/processing/plot.py +++ b/rally/task/processing/plot.py @@ -140,6 +140,7 @@ def _process_scenario(data, pos): "runner": kw["runner"]["type"], "config": json.dumps({data["key"]["name"]: [kw]}, indent=2), "hooks": _process_hooks(data["hooks"]), + "description": data["key"].get("description", ""), "iterations": { "iter": main_area.render(), "pie": [("success", (data["info"]["iterations_count"] diff --git a/rally/ui/templates/task/report.html b/rally/ui/templates/task/report.html index e3400b77c0..1e60f9d621 100644 --- a/rally/ui/templates/task/report.html +++ b/rally/ui/templates/task/report.html @@ -473,6 +473,9 @@

{{scenario.cls}}.{{scenario.name}} ({{scenario.full_duration | number:3}}s)

+
+ {{scenario.description}} +