Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.

Commit d5a7efd

Browse files
committed
refactor: improve docstring for _get_params function and simplify parameter calculation
1 parent a283c89 commit d5a7efd

1 file changed

Lines changed: 18 additions & 11 deletions

File tree

tests/perf/microbenchmarks/reads/config.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,23 @@
2424

2525

2626
def _get_params() -> Dict[str, List[ReadParameters]]:
27-
"""
28-
Docstring for _get_params
29-
1. this function output a list of readParameters.
30-
2. to populate the values of readparameters, use default values from config.yaml
31-
3. generate all possible params , ie
32-
no. of params should be equal to bucket_type*file_size_mib, chunk_size * process * coros
33-
you may use itertools.product
27+
"""Generates a dictionary of benchmark parameters for read operations.
28+
29+
This function reads configuration from a `config.yaml` file, which defines
30+
common parameters (like bucket types, file sizes) and different workloads.
31+
It then generates all possible combinations of these parameters for each
32+
workload using `itertools.product`.
33+
34+
The resulting parameter sets are encapsulated in `ReadParameters` objects
35+
and organized by workload name in the returned dictionary.
36+
37+
Bucket names can be overridden by setting the `DEFAULT_RAPID_ZONAL_BUCKET`
38+
and `DEFAULT_STANDARD_BUCKET` environment variables.
39+
40+
Returns:
41+
Dict[str, List[ReadParameters]]: A dictionary where keys are workload
42+
names (e.g., 'read_seq', 'read_rand_multi_coros') and values are lists
43+
of `ReadParameters` objects, each representing a unique benchmark scenario.
3444
"""
3545
params: Dict[str, List[ReadParameters]] = {}
3646
config_path = os.path.join(os.path.dirname(__file__), "config.yaml")
@@ -75,10 +85,7 @@ def _get_params() -> Dict[str, List[ReadParameters]]:
7585
chunk_size_bytes = chunk_size_mib * 1024 * 1024
7686
bucket_name = bucket_map[bucket_type]
7787

78-
if "single_file" in workload_name:
79-
num_files = 1
80-
else:
81-
num_files = num_processes * num_coros
88+
num_files = num_processes * num_coros
8289

8390
# Create a descriptive name for the parameter set
8491
name = f"{pattern}_{bucket_type}_{num_processes}p_{num_coros}c"

0 commit comments

Comments
 (0)