`run` accepts either --workload-repository or --workload-path, but `aggregate`
only accepted --workload-repository. A test run made against a workload on
disk therefore could not be aggregated: the aggregator loads the workload to
read its schedule, and looking the workload up in a repository fails when it
only exists as a path.
$ opensearch-benchmark aggregate --test-runs=<id1>,<id2> \
--workload-path=/path/to/workload
opensearch-benchmark: error: unrecognized arguments: --workload-path=...
The aggregate parser now uses the same add_workload_source helper as `run`, so
the two options stay mutually exclusive and --workload-revision comes along
with them, and dispatch calls configure_workload_params with
command_requires_workload=False, matching how `list` already handles a command
that takes a workload source but no --workload. The aggregator skips setting
repository.name when a path was given, since naming a repository as well would
send the loader looking for the workload inside that repository.
Signed-off-by: Serhiy Bzhezytskyy <me@serhiy-bzhezytskyy.com>
Description
add_workload_source()offers a workload either as a repository or as a local path, andrun,listandinfoall use it.aggregatedefined only its own--workload-repository, so a test run made against a workload on disk could not be aggregated afterwards — the aggregator loads the workload to read its schedule, and a repository lookup fails for a workload that only exists as a path:The aggregate parser now uses the same
add_workload_sourcehelper asrun, so the two options stay mutually exclusive and--workload-revisioncomes along with them. Dispatch callsconfigure_workload_paramswithcommand_requires_workload=False, matching howlistalready handles a command that takes a workload source but no--workload—aggregategets the workload name from the stored test run.One behavioural detail: a path sets
workload.path, which is what makes the loader chooseSimpleWorkloadRepository. So when a path was given,aggregate()no longer names a repository — doing both would send the loader looking for the workload inside that repository instead. That guard is load-bearing, since argparse's default for--workload-repositoryis the string"default"rather thanNone.Issues Resolved
Resolves #1095
Testing
New functionality includes testing
Two new tests:
test_aggregate_names_the_workload_repository(unchanged behaviour when a repository is used) andtest_aggregate_leaves_a_workload_path_alone(norepository.nameis configured when a path is given).The shared
mock_argsfixture previously supplied noworkload_path, so the aggregator saw aMockattribute that happens to be truthy. It is now explicit — that fixture change is what makes the first test meaningful rather than accidentally passing.CLI verified by hand:
aggregate --workload-path=<dir>is accepted where it previously errored, aggregation succeeds end to end, and combining it with--workload-revisionis correctly rejected.Full suite:
1424 passed, 5 skipped(baseline onmainis 1422).pylintclean.Notes
Found while using Apache solr-orbit, a Python port of OSB with the same argparse structure, to run a multi-configuration benchmark campaign. The same change is proposed there as apache/solr-orbit#60. Third of three
aggregategaps I hit, and the only one that is a parity gap rather than a bug.There is a case for going further — a test run already records the workload it used, so
aggregatecould resolve the spec from the stored run and need no workload-source argument at all. I've gone with the parity fix because it is the smaller change and matches the existing pattern, but I'm open to the other shape if you'd rather have it.