Skip to content

Commit 9fc7824

Browse files
Refactor get_configuration to use a dataclass
I've introduced a new `BenchmarkConfig` frozen dataclass to provide a more structured way of handling benchmark configurations. I updated the `get_configuration` function in `tests/benchmark/utils.py` to return an instance of this dataclass. I have partially updated the call sites for `get_configuration` to use the new dataclass object. The following directories have been updated: - tests/benchmark/db_benchmark/groupby/ - tests/benchmark/db_benchmark/join/ - tests/benchmark/db_benchmark/sort/ - tests/benchmark/read_gbq_colab/ (except for sort_output.py) The remaining call sites in `tests/benchmark/read_gbq_colab/sort_output.py` and `tests/benchmark/tpch/` still need to be updated.
1 parent e5ff8f7 commit 9fc7824

File tree

21 files changed

+138
-256
lines changed

21 files changed

+138
-256
lines changed

tests/benchmark/db_benchmark/groupby/q1.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,15 @@
1818
import bigframes_vendored.db_benchmark.groupby_queries as vendored_dbbenchmark_groupby_queries
1919

2020
if __name__ == "__main__":
21-
(
22-
project_id,
23-
dataset_id,
24-
table_id,
25-
session,
26-
suffix,
27-
) = utils.get_configuration(include_table_id=True)
21+
config = utils.get_configuration(include_table_id=True)
2822
current_path = pathlib.Path(__file__).absolute()
2923

3024
utils.get_execution_time(
3125
vendored_dbbenchmark_groupby_queries.q1,
3226
current_path,
33-
suffix,
34-
project_id,
35-
dataset_id,
36-
table_id,
37-
session,
27+
config.benchmark_suffix,
28+
config.project_id,
29+
config.dataset_id,
30+
config.table_id,
31+
config.session,
3832
)

tests/benchmark/db_benchmark/groupby/q10.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,15 @@
1818
import bigframes_vendored.db_benchmark.groupby_queries as vendored_dbbenchmark_groupby_queries
1919

2020
if __name__ == "__main__":
21-
(
22-
project_id,
23-
dataset_id,
24-
table_id,
25-
session,
26-
suffix,
27-
) = utils.get_configuration(include_table_id=True)
21+
config = utils.get_configuration(include_table_id=True)
2822
current_path = pathlib.Path(__file__).absolute()
2923

3024
utils.get_execution_time(
3125
vendored_dbbenchmark_groupby_queries.q10,
3226
current_path,
33-
suffix,
34-
project_id,
35-
dataset_id,
36-
table_id,
37-
session,
27+
config.benchmark_suffix,
28+
config.project_id,
29+
config.dataset_id,
30+
config.table_id,
31+
config.session,
3832
)

tests/benchmark/db_benchmark/groupby/q2.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,15 @@
1818
import bigframes_vendored.db_benchmark.groupby_queries as vendored_dbbenchmark_groupby_queries
1919

2020
if __name__ == "__main__":
21-
(
22-
project_id,
23-
dataset_id,
24-
table_id,
25-
session,
26-
suffix,
27-
) = utils.get_configuration(include_table_id=True)
21+
config = utils.get_configuration(include_table_id=True)
2822
current_path = pathlib.Path(__file__).absolute()
2923

3024
utils.get_execution_time(
3125
vendored_dbbenchmark_groupby_queries.q2,
3226
current_path,
33-
suffix,
34-
project_id,
35-
dataset_id,
36-
table_id,
37-
session,
27+
config.benchmark_suffix,
28+
config.project_id,
29+
config.dataset_id,
30+
config.table_id,
31+
config.session,
3832
)

tests/benchmark/db_benchmark/groupby/q3.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,15 @@
1818
import bigframes_vendored.db_benchmark.groupby_queries as vendored_dbbenchmark_groupby_queries
1919

2020
if __name__ == "__main__":
21-
(
22-
project_id,
23-
dataset_id,
24-
table_id,
25-
session,
26-
suffix,
27-
) = utils.get_configuration(include_table_id=True)
21+
config = utils.get_configuration(include_table_id=True)
2822
current_path = pathlib.Path(__file__).absolute()
2923

3024
utils.get_execution_time(
3125
vendored_dbbenchmark_groupby_queries.q3,
3226
current_path,
33-
suffix,
34-
project_id,
35-
dataset_id,
36-
table_id,
37-
session,
27+
config.benchmark_suffix,
28+
config.project_id,
29+
config.dataset_id,
30+
config.table_id,
31+
config.session,
3832
)

tests/benchmark/db_benchmark/groupby/q4.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,15 @@
1818
import bigframes_vendored.db_benchmark.groupby_queries as vendored_dbbenchmark_groupby_queries
1919

2020
if __name__ == "__main__":
21-
(
22-
project_id,
23-
dataset_id,
24-
table_id,
25-
session,
26-
suffix,
27-
) = utils.get_configuration(include_table_id=True)
21+
config = utils.get_configuration(include_table_id=True)
2822
current_path = pathlib.Path(__file__).absolute()
2923

3024
utils.get_execution_time(
3125
vendored_dbbenchmark_groupby_queries.q4,
3226
current_path,
33-
suffix,
34-
project_id,
35-
dataset_id,
36-
table_id,
37-
session,
27+
config.benchmark_suffix,
28+
config.project_id,
29+
config.dataset_id,
30+
config.table_id,
31+
config.session,
3832
)

tests/benchmark/db_benchmark/groupby/q5.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,15 @@
1818
import bigframes_vendored.db_benchmark.groupby_queries as vendored_dbbenchmark_groupby_queries
1919

2020
if __name__ == "__main__":
21-
(
22-
project_id,
23-
dataset_id,
24-
table_id,
25-
session,
26-
suffix,
27-
) = utils.get_configuration(include_table_id=True)
21+
config = utils.get_configuration(include_table_id=True)
2822
current_path = pathlib.Path(__file__).absolute()
2923

3024
utils.get_execution_time(
3125
vendored_dbbenchmark_groupby_queries.q5,
3226
current_path,
33-
suffix,
34-
project_id,
35-
dataset_id,
36-
table_id,
37-
session,
27+
config.benchmark_suffix,
28+
config.project_id,
29+
config.dataset_id,
30+
config.table_id,
31+
config.session,
3832
)

tests/benchmark/db_benchmark/groupby/q6.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,15 @@
1818
import bigframes_vendored.db_benchmark.groupby_queries as vendored_dbbenchmark_groupby_queries
1919

2020
if __name__ == "__main__":
21-
(
22-
project_id,
23-
dataset_id,
24-
table_id,
25-
session,
26-
suffix,
27-
) = utils.get_configuration(include_table_id=True)
21+
config = utils.get_configuration(include_table_id=True)
2822
current_path = pathlib.Path(__file__).absolute()
2923

3024
utils.get_execution_time(
3125
vendored_dbbenchmark_groupby_queries.q6,
3226
current_path,
33-
suffix,
34-
project_id,
35-
dataset_id,
36-
table_id,
37-
session,
27+
config.benchmark_suffix,
28+
config.project_id,
29+
config.dataset_id,
30+
config.table_id,
31+
config.session,
3832
)

tests/benchmark/db_benchmark/groupby/q7.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,15 @@
1818
import bigframes_vendored.db_benchmark.groupby_queries as vendored_dbbenchmark_groupby_queries
1919

2020
if __name__ == "__main__":
21-
(
22-
project_id,
23-
dataset_id,
24-
table_id,
25-
session,
26-
suffix,
27-
) = utils.get_configuration(include_table_id=True)
21+
config = utils.get_configuration(include_table_id=True)
2822
current_path = pathlib.Path(__file__).absolute()
2923

3024
utils.get_execution_time(
3125
vendored_dbbenchmark_groupby_queries.q7,
3226
current_path,
33-
suffix,
34-
project_id,
35-
dataset_id,
36-
table_id,
37-
session,
27+
config.benchmark_suffix,
28+
config.project_id,
29+
config.dataset_id,
30+
config.table_id,
31+
config.session,
3832
)

tests/benchmark/db_benchmark/groupby/q8.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,15 @@
1818
import bigframes_vendored.db_benchmark.groupby_queries as vendored_dbbenchmark_groupby_queries
1919

2020
if __name__ == "__main__":
21-
(
22-
project_id,
23-
dataset_id,
24-
table_id,
25-
session,
26-
suffix,
27-
) = utils.get_configuration(include_table_id=True)
21+
config = utils.get_configuration(include_table_id=True)
2822
current_path = pathlib.Path(__file__).absolute()
2923

3024
utils.get_execution_time(
3125
vendored_dbbenchmark_groupby_queries.q8,
3226
current_path,
33-
suffix,
34-
project_id,
35-
dataset_id,
36-
table_id,
37-
session,
27+
config.benchmark_suffix,
28+
config.project_id,
29+
config.dataset_id,
30+
config.table_id,
31+
config.session,
3832
)

tests/benchmark/db_benchmark/join/q1.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,16 @@
1818
import bigframes_vendored.db_benchmark.join_queries as vendored_dbbenchmark_join_queries
1919

2020
if __name__ == "__main__":
21-
(
22-
project_id,
23-
dataset_id,
24-
table_id,
25-
session,
26-
suffix,
27-
) = utils.get_configuration(include_table_id=True)
21+
config = utils.get_configuration(include_table_id=True)
2822

2923
current_path = pathlib.Path(__file__).absolute()
3024

3125
utils.get_execution_time(
3226
vendored_dbbenchmark_join_queries.q1,
3327
current_path,
34-
suffix,
35-
project_id,
36-
dataset_id,
37-
table_id,
38-
session,
28+
config.benchmark_suffix,
29+
config.project_id,
30+
config.dataset_id,
31+
config.table_id,
32+
config.session,
3933
)

0 commit comments

Comments
 (0)