diff --git a/scripts/scaling.py b/scripts/scaling.py index 7fcfd929..a0c1d036 100755 --- a/scripts/scaling.py +++ b/scripts/scaling.py @@ -433,11 +433,13 @@ def block(args, output, config, variant, repeats): def series(args, output): every = range(args.first_repeat, args.first_repeat + args.repeats) - for config in args.configs.split(","): - if len(args.variants) == 1: + configs = args.configs.split(",") + if not args.rates: + for config in configs: block(args, output, config, args.variants[0], every) - continue - for repeat in every: + return + for repeat in every: + for config in configs: for variant in args.variants: block(args, output, config, variant, [repeat]) diff --git a/student-tests/unit/test_scaling.py b/student-tests/unit/test_scaling.py index 4f7cfff3..a862032e 100644 --- a/student-tests/unit/test_scaling.py +++ b/student-tests/unit/test_scaling.py @@ -52,3 +52,29 @@ def test_disturbed_runs_never_enter_summary( scaling.block(args, output, "1x1", "base", [1]) output.writerows.assert_not_called() assert args.rejected.writerow.call_count == 2 + + +@pytest.mark.parametrize( + ("fixed", "expected"), + [ + (True, [("4x1", [2]), ("8x0.5", [2]), ("4x1", [3]), ("8x0.5", [3])]), + (False, [("4x1", [2, 3]), ("8x0.5", [2, 3])]), + ], +) +def test_series_order( + scaling: ModuleType, + monkeypatch: pytest.MonkeyPatch, + fixed: bool, + expected: list[tuple[str, list[int]]], +) -> None: + args = SimpleNamespace( + first_repeat=2, + repeats=2, + configs="4x1,8x0.5", + variants=["pinned"], + rates="3040,4560" if fixed else None, + ) + block = Mock() + monkeypatch.setattr(scaling, "block", block) + scaling.series(args, Mock()) + assert [(call.args[2], list(call.args[4])) for call in block.call_args_list] == expected