diff options
| author | Олег <[email protected]> | 2024-08-29 17:11:45 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-08-29 14:11:45 +0000 |
| commit | 05ecf8ae7a6766f67e5f1e159d515482b645cdc9 (patch) | |
| tree | b0509abae8ab165d675419df0a7ef56adc47daa2 | |
| parent | 4aa213ada8f9a645310f6c03f66756e61dd87796 (diff) | |
add plan.svg to benchmark report (#8464)
| -rw-r--r-- | ydb/core/fq/libs/compute/common/utils.cpp | 2 | ||||
| -rw-r--r-- | ydb/core/fq/libs/compute/common/ya.make | 2 | ||||
| -rw-r--r-- | ydb/public/lib/ydb_cli/commands/ydb_benchmark.cpp | 11 | ||||
| -rw-r--r-- | ydb/public/lib/ydb_cli/common/plan2svg.cpp (renamed from ydb/core/fq/libs/compute/common/plan2svg.cpp) | 0 | ||||
| -rw-r--r-- | ydb/public/lib/ydb_cli/common/plan2svg.h (renamed from ydb/core/fq/libs/compute/common/plan2svg.h) | 0 | ||||
| -rw-r--r-- | ydb/public/lib/ydb_cli/common/ya.make | 1 | ||||
| -rw-r--r-- | ydb/tests/olap/lib/ydb_cli.py | 6 | ||||
| -rw-r--r-- | ydb/tests/olap/load/conftest.py | 2 |
8 files changed, 19 insertions, 5 deletions
diff --git a/ydb/core/fq/libs/compute/common/utils.cpp b/ydb/core/fq/libs/compute/common/utils.cpp index 65faf14186d..f0e7af1f022 100644 --- a/ydb/core/fq/libs/compute/common/utils.cpp +++ b/ydb/core/fq/libs/compute/common/utils.cpp @@ -1,5 +1,5 @@ #include "utils.h" -#include "plan2svg.h" +#include <ydb/public/lib/ydb_cli/common/plan2svg.h> #include <library/cpp/json/json_reader.h> #include <library/cpp/json/json_writer.h> diff --git a/ydb/core/fq/libs/compute/common/ya.make b/ydb/core/fq/libs/compute/common/ya.make index 50bf35b6adc..efdb5409773 100644 --- a/ydb/core/fq/libs/compute/common/ya.make +++ b/ydb/core/fq/libs/compute/common/ya.make @@ -2,7 +2,6 @@ LIBRARY() SRCS( pinger.cpp - plan2svg.cpp run_actor_params.cpp utils.cpp ) @@ -20,6 +19,7 @@ PEERDIR( ydb/library/yql/providers/generic/connector/api/service/protos ydb/library/yql/providers/generic/connector/libcpp ydb/library/yql/providers/s3/actors_factory + ydb/public/lib/ydb_cli/common ) YQL_LAST_ABI_VERSION() diff --git a/ydb/public/lib/ydb_cli/commands/ydb_benchmark.cpp b/ydb/public/lib/ydb_cli/commands/ydb_benchmark.cpp index 557bfbd41e6..30cdd8e3e5d 100644 --- a/ydb/public/lib/ydb_cli/commands/ydb_benchmark.cpp +++ b/ydb/public/lib/ydb_cli/commands/ydb_benchmark.cpp @@ -1,7 +1,8 @@ #include "ydb_benchmark.h" #include "benchmark_utils.h" -#include <ydb/public/lib/ydb_cli/common/pretty_table.h> #include <ydb/public/lib/ydb_cli/common/format.h> +#include <ydb/public/lib/ydb_cli/common/plan2svg.h> +#include <ydb/public/lib/ydb_cli/common/pretty_table.h> #include <library/cpp/json/json_writer.h> #include <util/string/printf.h> #include <util/folder/path.h> @@ -93,7 +94,7 @@ TString TWorkloadCommandBenchmark::PatchQuery(const TStringBuf& original) const std::vector<TStringBuf> lines; for (auto& line : StringSplitter(result).Split('\n').SkipEmpty()) { - if (line.StartsWith("--")) { + if (line.StartsWith("--") && !line.StartsWith("--!")) { continue; } @@ -386,6 +387,12 @@ bool TWorkloadCommandBenchmark::RunBench(TClient& client, NYdbWorkload::IWorkloa TFileOutput out(PlanFileName + ".ast"); out << res.GetPlanAst(); } + { + TPlanVisualizer pv; + pv.LoadPlans(res.GetQueryPlan()); + TFileOutput out(PlanFileName + ".svg"); + out << pv.PrintSvgSafe(); + } planSaved = true; } } diff --git a/ydb/core/fq/libs/compute/common/plan2svg.cpp b/ydb/public/lib/ydb_cli/common/plan2svg.cpp index a9a14d901b7..a9a14d901b7 100644 --- a/ydb/core/fq/libs/compute/common/plan2svg.cpp +++ b/ydb/public/lib/ydb_cli/common/plan2svg.cpp diff --git a/ydb/core/fq/libs/compute/common/plan2svg.h b/ydb/public/lib/ydb_cli/common/plan2svg.h index 7e2d858860f..7e2d858860f 100644 --- a/ydb/core/fq/libs/compute/common/plan2svg.h +++ b/ydb/public/lib/ydb_cli/common/plan2svg.h diff --git a/ydb/public/lib/ydb_cli/common/ya.make b/ydb/public/lib/ydb_cli/common/ya.make index 533d768660f..16c9c4835ee 100644 --- a/ydb/public/lib/ydb_cli/common/ya.make +++ b/ydb/public/lib/ydb_cli/common/ya.make @@ -13,6 +13,7 @@ SRCS( parameter_stream.cpp parameters.cpp pg_dump_parser.cpp + plan2svg.cpp pretty_table.cpp print_operation.cpp print_utils.cpp diff --git a/ydb/tests/olap/lib/ydb_cli.py b/ydb/tests/olap/lib/ydb_cli.py index 5c0356dd4f3..938751a7ea6 100644 --- a/ydb/tests/olap/lib/ydb_cli.py +++ b/ydb/tests/olap/lib/ydb_cli.py @@ -26,10 +26,11 @@ class YdbCliHelper: return [cli] class QueuePlan: - def __init__(self, plan: dict | None = None, table: str | None = None, ast: str | None = None) -> None: + def __init__(self, plan: dict | None = None, table: str | None = None, ast: str | None = None, svg: str | None = None) -> None: self.plan = plan self.table = table self.ast = ast + self.svg = svg class WorkloadRunResult: def __init__( @@ -115,6 +116,9 @@ class YdbCliHelper: if (os.path.exists(plan_path + '.ast')): with open(plan_path + '.ast') as f: plan.ast = f.read() + if (os.path.exists(plan_path + '.svg')): + with open(plan_path + '.svg') as f: + plan.svg = f.read() return YdbCliHelper.WorkloadRunResult( stats=stats, diff --git a/ydb/tests/olap/load/conftest.py b/ydb/tests/olap/load/conftest.py index 0606732aff6..d4347ecbed0 100644 --- a/ydb/tests/olap/load/conftest.py +++ b/ydb/tests/olap/load/conftest.py @@ -46,6 +46,8 @@ class LoadSuiteBase: allure.attach(result.plan.table, 'Plan table', attachment_type=allure.attachment_type.TEXT) if result.plan.ast is not None: allure.attach(result.plan.ast, 'Plan ast', attachment_type=allure.attachment_type.TEXT) + if result.plan.svg is not None: + allure.attach(result.plan.svg, 'Plan svg', attachment_type=allure.attachment_type.SVG) if result.stdout is not None: allure.attach(result.stdout, 'Stdout', attachment_type=allure.attachment_type.TEXT) |
