Skip to content

Commit 826a70c

Browse files
I will refactor get_configuration to use a dataclass.
This change introduces a new `BenchmarkConfig` frozen dataclass to provide a more structured way of handling benchmark configurations. The `get_configuration` function in `tests/benchmark/utils.py` will be updated to return an instance of this dataclass. All call sites for `get_configuration` will be updated to use the new dataclass object.
1 parent 9fc7824 commit 826a70c

File tree

23 files changed

+160
-56
lines changed

23 files changed

+160
-56
lines changed

tests/benchmark/read_gbq_colab/sort_output.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,15 @@ def sort_output(
4444

4545

4646
if __name__ == "__main__":
47-
(
48-
project_id,
49-
dataset_id,
50-
table_id,
51-
session,
52-
suffix,
53-
) = utils.get_configuration(include_table_id=True)
47+
config = utils.get_configuration(include_table_id=True)
5448
current_path = pathlib.Path(__file__).absolute()
5549

5650
utils.get_execution_time(
5751
sort_output,
5852
current_path,
59-
suffix,
60-
project_id=project_id,
61-
dataset_id=dataset_id,
62-
table_id=table_id,
63-
session=session,
53+
config.benchmark_suffix,
54+
project_id=config.project_id,
55+
dataset_id=config.dataset_id,
56+
table_id=config.table_id,
57+
session=config.session,
6458
)

tests/benchmark/tpch/q1.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@
1717
import bigframes_vendored.tpch.queries.q1 as vendored_tpch_q1
1818

1919
if __name__ == "__main__":
20-
project_id, dataset_id, session, suffix = utils.get_configuration()
20+
config = utils.get_configuration()
2121
current_path = pathlib.Path(__file__).absolute()
2222

2323
utils.get_execution_time(
24-
vendored_tpch_q1.q, current_path, suffix, project_id, dataset_id, session
24+
vendored_tpch_q1.q,
25+
current_path,
26+
config.benchmark_suffix,
27+
config.project_id,
28+
config.dataset_id,
29+
config.session,
2530
)

tests/benchmark/tpch/q10.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@
1717
import bigframes_vendored.tpch.queries.q10 as vendored_tpch_q10
1818

1919
if __name__ == "__main__":
20-
project_id, dataset_id, session, suffix = utils.get_configuration()
20+
config = utils.get_configuration()
2121
current_path = pathlib.Path(__file__).absolute()
2222

2323
utils.get_execution_time(
24-
vendored_tpch_q10.q, current_path, suffix, project_id, dataset_id, session
24+
vendored_tpch_q10.q,
25+
current_path,
26+
config.benchmark_suffix,
27+
config.project_id,
28+
config.dataset_id,
29+
config.session,
2530
)

tests/benchmark/tpch/q11.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@
1717
import bigframes_vendored.tpch.queries.q11 as vendored_tpch_q11
1818

1919
if __name__ == "__main__":
20-
project_id, dataset_id, session, suffix = utils.get_configuration()
20+
config = utils.get_configuration()
2121
current_path = pathlib.Path(__file__).absolute()
2222

2323
utils.get_execution_time(
24-
vendored_tpch_q11.q, current_path, suffix, project_id, dataset_id, session
24+
vendored_tpch_q11.q,
25+
current_path,
26+
config.benchmark_suffix,
27+
config.project_id,
28+
config.dataset_id,
29+
config.session,
2530
)

tests/benchmark/tpch/q12.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@
1717
import bigframes_vendored.tpch.queries.q12 as vendored_tpch_q12
1818

1919
if __name__ == "__main__":
20-
project_id, dataset_id, session, suffix = utils.get_configuration()
20+
config = utils.get_configuration()
2121
current_path = pathlib.Path(__file__).absolute()
2222

2323
utils.get_execution_time(
24-
vendored_tpch_q12.q, current_path, suffix, project_id, dataset_id, session
24+
vendored_tpch_q12.q,
25+
current_path,
26+
config.benchmark_suffix,
27+
config.project_id,
28+
config.dataset_id,
29+
config.session,
2530
)

tests/benchmark/tpch/q13.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@
1717
import bigframes_vendored.tpch.queries.q13 as vendored_tpch_q13
1818

1919
if __name__ == "__main__":
20-
project_id, dataset_id, session, suffix = utils.get_configuration()
20+
config = utils.get_configuration()
2121
current_path = pathlib.Path(__file__).absolute()
2222

2323
utils.get_execution_time(
24-
vendored_tpch_q13.q, current_path, suffix, project_id, dataset_id, session
24+
vendored_tpch_q13.q,
25+
current_path,
26+
config.benchmark_suffix,
27+
config.project_id,
28+
config.dataset_id,
29+
config.session,
2530
)

tests/benchmark/tpch/q14.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@
1717
import bigframes_vendored.tpch.queries.q14 as vendored_tpch_q14
1818

1919
if __name__ == "__main__":
20-
project_id, dataset_id, session, suffix = utils.get_configuration()
20+
config = utils.get_configuration()
2121
current_path = pathlib.Path(__file__).absolute()
2222

2323
utils.get_execution_time(
24-
vendored_tpch_q14.q, current_path, suffix, project_id, dataset_id, session
24+
vendored_tpch_q14.q,
25+
current_path,
26+
config.benchmark_suffix,
27+
config.project_id,
28+
config.dataset_id,
29+
config.session,
2530
)

tests/benchmark/tpch/q15.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@
1717
import bigframes_vendored.tpch.queries.q15 as vendored_tpch_q15
1818

1919
if __name__ == "__main__":
20-
project_id, dataset_id, session, suffix = utils.get_configuration()
20+
config = utils.get_configuration()
2121
current_path = pathlib.Path(__file__).absolute()
2222

2323
utils.get_execution_time(
24-
vendored_tpch_q15.q, current_path, suffix, project_id, dataset_id, session
24+
vendored_tpch_q15.q,
25+
current_path,
26+
config.benchmark_suffix,
27+
config.project_id,
28+
config.dataset_id,
29+
config.session,
2530
)

tests/benchmark/tpch/q16.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@
1717
import bigframes_vendored.tpch.queries.q16 as vendored_tpch_q16
1818

1919
if __name__ == "__main__":
20-
project_id, dataset_id, session, suffix = utils.get_configuration()
20+
config = utils.get_configuration()
2121
current_path = pathlib.Path(__file__).absolute()
2222

2323
utils.get_execution_time(
24-
vendored_tpch_q16.q, current_path, suffix, project_id, dataset_id, session
24+
vendored_tpch_q16.q,
25+
current_path,
26+
config.benchmark_suffix,
27+
config.project_id,
28+
config.dataset_id,
29+
config.session,
2530
)

tests/benchmark/tpch/q17.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@
1717
import bigframes_vendored.tpch.queries.q17 as vendored_tpch_q17
1818

1919
if __name__ == "__main__":
20-
project_id, dataset_id, session, suffix = utils.get_configuration()
20+
config = utils.get_configuration()
2121
current_path = pathlib.Path(__file__).absolute()
2222

2323
utils.get_execution_time(
24-
vendored_tpch_q17.q, current_path, suffix, project_id, dataset_id, session
24+
vendored_tpch_q17.q,
25+
current_path,
26+
config.benchmark_suffix,
27+
config.project_id,
28+
config.dataset_id,
29+
config.session,
2530
)

0 commit comments

Comments
 (0)