Skip to content

Commit b0b4a13

Browse files
author
zhixiangli
committed
refactor: rename read/write_fixed_duration to read/write in microbenchmarks
1 parent 6c5f744 commit b0b4a13

File tree

12 files changed

+37
-39
lines changed

12 files changed

+37
-39
lines changed

gcsfs/tests/conftest.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,10 +484,8 @@ def pytest_ignore_collect(collection_path, config):
484484
"delete",
485485
"listing",
486486
"read",
487-
"read_fixed_duration",
488487
"rename",
489488
"write",
490-
"write_fixed_duration",
491489
"info",
492490
}
493491

gcsfs/tests/perf/microbenchmarks/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Configuration values are stored in YAML files (e.g., `configs.yaml`) located wit
5757

5858
## Configurators
5959

60-
Configurators are Python classes (e.g., `ReadFixedDurationConfigurator`, `ListingConfigurator`) responsible for parsing the YAML configuration files and converting them into a list of parameter objects (`BenchmarkParameters`). These objects are then consumed by the test files to generate parameterized test cases.
60+
Configurators are Python classes (e.g., `ReadConfigurator`, `ListingConfigurator`) responsible for parsing the YAML configuration files and converting them into a list of parameter objects (`BenchmarkParameters`). These objects are then consumed by the test files to generate parameterized test cases.
6161

6262
## Benchmark File
6363

@@ -77,7 +77,7 @@ The `run.py` script is the central entry point for executing benchmarks. It hand
7777

7878
| Option | Description | Required |
7979
| :--- | :--- | :--- |
80-
| `--group` | The benchmark group to run (e.g., `read`, `write`, `read_fixed_duration`, `write_fixed_duration`, `listing`, `info`). Runs all groups if not specified. | No |
80+
| `--group` | The benchmark group to run (e.g., `read`, `write`, `listing`, `info`). Runs all groups if not specified. | No |
8181
| `--config` | Specific scenario names to run (e.g., `read_seq`, `list_flat`). Accepts multiple values. | No |
8282
| `--regional-bucket` | Name of the regional GCS bucket. | Yes* |
8383
| `--zonal-bucket` | Name of the zonal GCS bucket. | Yes* |

gcsfs/tests/perf/microbenchmarks/read_fixed_duration/configs.py renamed to gcsfs/tests/perf/microbenchmarks/read/configs.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
from gcsfs.tests.perf.microbenchmarks.configs import BaseBenchmarkConfigurator
44
from gcsfs.tests.perf.microbenchmarks.conftest import MB
55

6-
from .parameters import ReadFixedDurationBenchmarkParameters
6+
from .parameters import ReadBenchmarkParameters
77

88

9-
class ReadFixedDurationConfigurator(BaseBenchmarkConfigurator):
9+
class ReadConfigurator(BaseBenchmarkConfigurator):
1010
def build_cases(self, scenario, common_config):
1111
procs_list = scenario.get("processes", [1])
1212
threads_list = scenario.get("threads", [1])
@@ -41,7 +41,7 @@ def build_cases(self, scenario, common_config):
4141
else:
4242
files_count = threads * procs
4343

44-
params = ReadFixedDurationBenchmarkParameters(
44+
params = ReadBenchmarkParameters(
4545
name=name,
4646
pattern=pattern,
4747
bucket_name=bucket_name,
@@ -59,5 +59,5 @@ def build_cases(self, scenario, common_config):
5959
return cases
6060

6161

62-
def get_read_fixed_duration_benchmark_cases():
63-
return ReadFixedDurationConfigurator(__file__).generate_cases()
62+
def get_read_benchmark_cases():
63+
return ReadConfigurator(__file__).generate_cases()

gcsfs/tests/perf/microbenchmarks/read_fixed_duration/configs.yaml renamed to gcsfs/tests/perf/microbenchmarks/read/configs.yaml

File renamed without changes.

gcsfs/tests/perf/microbenchmarks/read_fixed_duration/parameters.py renamed to gcsfs/tests/perf/microbenchmarks/read/parameters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
@dataclass
7-
class ReadFixedDurationBenchmarkParameters(IOBenchmarkParameters):
7+
class ReadBenchmarkParameters(IOBenchmarkParameters):
88
"""
99
Defines the parameters for a read benchmark test cases with runtime.
1010
"""

gcsfs/tests/perf/microbenchmarks/read_fixed_duration/test_read.py renamed to gcsfs/tests/perf/microbenchmarks/read/test_read.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55

66
import pytest
77

8-
from gcsfs.tests.perf.microbenchmarks.read_fixed_duration.configs import (
9-
get_read_fixed_duration_benchmark_cases,
8+
from gcsfs.tests.perf.microbenchmarks.read.configs import (
9+
get_read_benchmark_cases,
1010
)
1111
from gcsfs.tests.perf.microbenchmarks.runner import (
1212
filter_test_cases,
1313
run_multi_process,
1414
run_single_threaded_fixed_duration,
1515
)
1616

17-
BENCHMARK_GROUP = "read_fixed_duration"
17+
BENCHMARK_GROUP = "read"
1818

1919

2020
def _read_op_seq(gcs, file_paths, chunk_size, runtime):
@@ -57,7 +57,7 @@ def _random_read_worker(gcs, file_paths, chunk_size, offsets, runtime):
5757
return _read_op_rand(gcs, file_paths, chunk_size, local_offsets, runtime)
5858

5959

60-
all_benchmark_cases = get_read_fixed_duration_benchmark_cases()
60+
all_benchmark_cases = get_read_benchmark_cases()
6161
single_threaded_cases, _, multi_process_cases = filter_test_cases(all_benchmark_cases)
6262

6363

gcsfs/tests/perf/microbenchmarks/test_configs.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
ListingConfigurator,
1313
get_listing_benchmark_cases,
1414
)
15-
from gcsfs.tests.perf.microbenchmarks.read_fixed_duration.configs import (
16-
ReadFixedDurationConfigurator,
17-
get_read_fixed_duration_benchmark_cases,
15+
from gcsfs.tests.perf.microbenchmarks.read.configs import (
16+
ReadConfigurator,
17+
get_read_benchmark_cases,
1818
)
1919
from gcsfs.tests.perf.microbenchmarks.rename.configs import get_rename_benchmark_cases
20-
from gcsfs.tests.perf.microbenchmarks.write_fixed_duration.configs import (
21-
WriteFixedDurationConfigurator,
22-
get_write_fixed_duration_benchmark_cases,
20+
from gcsfs.tests.perf.microbenchmarks.write.configs import (
21+
WriteConfigurator,
22+
get_write_benchmark_cases,
2323
)
2424

2525
MB = 1024 * 1024
@@ -81,7 +81,7 @@ def test_read_configurator(mock_config_dependencies):
8181
}
8282
scenario = {"name": "read_test", "processes": [1], "threads": [1], "pattern": "seq"}
8383

84-
configurator = ReadFixedDurationConfigurator("dummy")
84+
configurator = ReadConfigurator("dummy")
8585
cases = configurator.build_cases(scenario, common)
8686

8787
assert len(cases) == 1
@@ -104,7 +104,7 @@ def test_write_configurator(mock_config_dependencies):
104104
}
105105
scenario = {"name": "write_test", "processes": [2], "threads": [1]}
106106

107-
configurator = WriteFixedDurationConfigurator("dummy")
107+
configurator = WriteConfigurator("dummy")
108108
cases = configurator.build_cases(scenario, common)
109109

110110
assert len(cases) == 1
@@ -188,7 +188,7 @@ def test_generate_cases_calls_load(mock_config_dependencies):
188188
mock.patch("yaml.safe_load", return_value=config_content),
189189
):
190190

191-
configurator = WriteFixedDurationConfigurator("dummy")
191+
configurator = WriteConfigurator("dummy")
192192
cases = configurator.generate_cases()
193193
assert len(cases) == 1
194194
assert cases[0].name.startswith("test")
@@ -203,11 +203,11 @@ def test_validate_actual_yaml_configs():
203203
# Ensure BENCHMARK_FILTER is empty so we load all cases
204204
with mock.patch("gcsfs.tests.perf.microbenchmarks.configs.BENCHMARK_FILTER", ""):
205205
# Read
206-
cases = get_read_fixed_duration_benchmark_cases()
206+
cases = get_read_benchmark_cases()
207207
assert len(cases) > 0, "Read config produced no cases"
208208

209209
# Write
210-
cases = get_write_fixed_duration_benchmark_cases()
210+
cases = get_write_benchmark_cases()
211211
assert len(cases) > 0, "Write config produced no cases"
212212

213213
# Listing

gcsfs/tests/perf/microbenchmarks/test_run.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_setup_environment_missing_buckets():
3434
@mock.patch("subprocess.run")
3535
@mock.patch("os.path.isdir", return_value=True)
3636
def test_run_benchmarks(mock_isdir, mock_subprocess):
37-
args = argparse.Namespace(group="read_fixed_duration", log="true", log_level="INFO")
37+
args = argparse.Namespace(group="read", log="true", log_level="INFO")
3838
results_dir = "/tmp/results"
3939

4040
expected_json_path = os.path.join(results_dir, "results.json")
@@ -55,7 +55,7 @@ def test_run_benchmarks(mock_isdir, mock_subprocess):
5555
def test_process_benchmark_result():
5656
bench = {
5757
"name": "test_bench",
58-
"group": "read_fixed_duration",
58+
"group": "read",
5959
"extra_info": {"file_size": 100, "files": 2},
6060
"stats": {"min": 0.1, "data": [0.1, 0.2]},
6161
}
@@ -66,7 +66,7 @@ def test_process_benchmark_result():
6666
row = run._process_benchmark_result(bench, headers, extra, stats)
6767

6868
assert row["name"] == "test_bench"
69-
assert row["group"] == "read_fixed_duration"
69+
assert row["group"] == "read"
7070
assert row["file_size"] == 100
7171
assert "p90" in row
7272

@@ -116,7 +116,7 @@ def test_format_mb():
116116
def test_create_table_row():
117117
row = {
118118
"bucket_type": "regional",
119-
"group": "read_fixed_duration",
119+
"group": "read",
120120
"pattern": "seq",
121121
"files": 1,
122122
"folders": 0,

gcsfs/tests/perf/microbenchmarks/write_fixed_duration/configs.py renamed to gcsfs/tests/perf/microbenchmarks/write/configs.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
from gcsfs.tests.perf.microbenchmarks.configs import BaseBenchmarkConfigurator
44
from gcsfs.tests.perf.microbenchmarks.conftest import MB
55

6-
from .parameters import WriteFixedDurationBenchmarkParameters
6+
from .parameters import WriteBenchmarkParameters
77

88

9-
class WriteFixedDurationConfigurator(BaseBenchmarkConfigurator):
9+
class WriteConfigurator(BaseBenchmarkConfigurator):
1010
def build_cases(self, scenario, common_config):
1111
procs_list = scenario.get("processes", [1])
1212
threads_list = scenario.get("threads", [1])
@@ -30,7 +30,7 @@ def build_cases(self, scenario, common_config):
3030
f"{chunk_size_mb}MB_chunk_{bucket_type}_{runtime}s_duration"
3131
)
3232

33-
params = WriteFixedDurationBenchmarkParameters(
33+
params = WriteBenchmarkParameters(
3434
name=name,
3535
bucket_name=bucket_name,
3636
bucket_type=bucket_type,
@@ -46,5 +46,5 @@ def build_cases(self, scenario, common_config):
4646
return cases
4747

4848

49-
def get_write_fixed_duration_benchmark_cases():
50-
return WriteFixedDurationConfigurator(__file__).generate_cases()
49+
def get_write_benchmark_cases():
50+
return WriteConfigurator(__file__).generate_cases()

gcsfs/tests/perf/microbenchmarks/write_fixed_duration/configs.yaml renamed to gcsfs/tests/perf/microbenchmarks/write/configs.yaml

File renamed without changes.

0 commit comments

Comments
 (0)