From 8bc321f75dee4beb4da1fd2b0d9f6b53181d369e Mon Sep 17 00:00:00 2001 From: Mikhail Andrenkov Date: Tue, 3 Oct 2023 09:29:07 -0400 Subject: [PATCH] Add support for parsing execution times from text build outputs --- .../services/parse_execution_times.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/qml_pipeline_utils/qml_pipeline_utils/services/parse_execution_times.py b/.github/workflows/qml_pipeline_utils/qml_pipeline_utils/services/parse_execution_times.py index 23facf001d..60fe0bac4c 100644 --- a/.github/workflows/qml_pipeline_utils/qml_pipeline_utils/services/parse_execution_times.py +++ b/.github/workflows/qml_pipeline_utils/qml_pipeline_utils/services/parse_execution_times.py @@ -94,18 +94,20 @@ def parse_execution_times( sphinx_build_directory: The directory where sphinx outputs the built demo html files sphinx_gallery_dir_name: The gallery directory name inside sphinx_build_directory where sphinx puts all gallery demo html files - sphinx_build_type: The output format of sphinx-build, Valid values are "html" and "json" + sphinx_build_type: The output format of sphinx-build, Valid values are "html", "json", and "text. glob_pattern: The pattern use to glob all demonstration files inside build_directory. Defaults to "*.py" """ - assert sphinx_build_type in {"html", "json"}, "Invalid sphinx build type" - if sphinx_build_type == "json": - sphinx_build_type = "fjson" + extensions = {"html": "html", "json": "fjson", "text": "txt"} + assert sphinx_build_type in extensions, "Invalid sphinx build type" + ext = # Hard coding the filename here as it is not something the user controls. # The sg_execution_times exists inside the directory sphinx puts all the built "galleries" sg_execution_file_location = ( - sphinx_build_directory / sphinx_gallery_dir_name / f"sg_execution_times.{sphinx_build_type}" + sphinx_build_directory + / sphinx_gallery_dir_name + / f"sg_execution_times.{extensions[sphinx_build_type]}" ) with sg_execution_file_location.open("r") as fh: