bt2 benchmark: add overwrite switch for branches dict
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Tue, 30 Jul 2019 21:02:39 +0000 (17:02 -0400)
committerJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Tue, 30 Jul 2019 21:02:39 +0000 (17:02 -0400)
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
scripts/babeltrace-benchmark/benchmark.py

index f43830a9c3f5b782113aadbc1718e94fc400e4d1..c7dc999b7b87eb9e04ba1bb61b168583d68dd056 100644 (file)
@@ -39,6 +39,17 @@ BENCHMARK_TYPES = ["dummy", "text"]
 DEFAULT_BUCKET = "lava"
 
 
+def json_type(string):
+    """
+    Argpase type for json args.
+    We expect a base dictionary.
+    """
+    passed_json = json.loads(string)
+    if not isinstance(passed_json, dict):
+        msg = "%r is not a dict" % string
+        raise argparse.ArgumentTypeError(msg)
+    return passed_json
+
 def graph_get_color(branch):
     """
     Get the color matching the branch.
@@ -410,9 +421,19 @@ def main():
     parser.add_argument(
         "--repo-path", help="The location of the git repo to use.", required=True
     )
+    parser.add_argument(
+        "--overwrite-branches-cutoff",
+        help="A dictionary of the form {"
+        "'branch_name': 'commit_hash_cutoff',...}. Allow custom graphing and"
+        "jobs generation.",
+        required=False, type=json_type
+    )
 
     args = parser.parse_args()
 
+    if args.overwrite_branches_cutoff:
+        bt_branches = args.overwrite_branches_cutoff
+
     if not os.path.exists(args.repo_path):
         print("Repository location does not exists.")
         return 1
This page took 0.024197 seconds and 4 git commands to generate.