diff --git a/mlos_bench/mlos_bench/tests/optimizers/conftest.py b/mlos_bench/mlos_bench/tests/optimizers/conftest.py index aaa6b14753a..9ffed3d80aa 100644 --- a/mlos_bench/mlos_bench/tests/optimizers/conftest.py +++ b/mlos_bench/mlos_bench/tests/optimizers/conftest.py @@ -21,24 +21,28 @@ def mock_configs() -> list[dict]: """Mock configurations of earlier experiments.""" return [ { + "123": 2, "vmSize": "Standard_B4ms", "idle": "halt", "kernel_sched_migration_cost_ns": 50000, "kernel_sched_latency_ns": 1000000, }, { + "123": 1, "vmSize": "Standard_B4ms", "idle": "halt", "kernel_sched_migration_cost_ns": 40000, "kernel_sched_latency_ns": 2000000, }, { + "123": 3, "vmSize": "Standard_B4ms", "idle": "mwait", "kernel_sched_migration_cost_ns": -1, # Special value "kernel_sched_latency_ns": 3000000, }, { + "123": 2, "vmSize": "Standard_B2s", "idle": "mwait", "kernel_sched_migration_cost_ns": 200000, diff --git a/mlos_bench/mlos_bench/tests/optimizers/mock_opt_test.py b/mlos_bench/mlos_bench/tests/optimizers/mock_opt_test.py index 05305de50b9..215f55be506 100644 --- a/mlos_bench/mlos_bench/tests/optimizers/mock_opt_test.py +++ b/mlos_bench/mlos_bench/tests/optimizers/mock_opt_test.py @@ -18,6 +18,7 @@ def mock_configurations_no_defaults() -> list: return [ ( { + "123": 2, "vmSize": "Standard_B4ms", "idle": "halt", "kernel_sched_migration_cost_ns": 13112, @@ -27,6 +28,7 @@ def mock_configurations_no_defaults() -> list: ), ( { + "123": 3, "vmSize": "Standard_B2ms", "idle": "halt", "kernel_sched_migration_cost_ns": 117026, @@ -36,6 +38,7 @@ def mock_configurations_no_defaults() -> list: ), ( { + "123": 1, "vmSize": "Standard_B4ms", "idle": "halt", "kernel_sched_migration_cost_ns": 354785, @@ -52,6 +55,7 @@ def mock_configurations(mock_configurations_no_defaults: list) -> list: return [ ( { + "123": 2, "vmSize": "Standard_B4ms", "idle": "halt", "kernel_sched_migration_cost_ns": -1, diff --git a/mlos_bench/mlos_bench/tests/optimizers/opt_bulk_register_test.py b/mlos_bench/mlos_bench/tests/optimizers/opt_bulk_register_test.py index 43ebc7c3915..012d3f5cae0 100644 --- a/mlos_bench/mlos_bench/tests/optimizers/opt_bulk_register_test.py +++ b/mlos_bench/mlos_bench/tests/optimizers/opt_bulk_register_test.py @@ -76,6 +76,7 @@ def _test_opt_update_max( assert score["score"] == pytest.approx(99.99, 0.01) assert tunables is not None assert tunables.get_param_values() == { + "123": 2, "vmSize": "Standard_B2s", "idle": "mwait", "kernel_sched_migration_cost_ns": 200000, diff --git a/mlos_bench/mlos_bench/tests/storage/exp_load_test.py b/mlos_bench/mlos_bench/tests/storage/exp_load_test.py index e07cf80c70a..ac56408551a 100644 --- a/mlos_bench/mlos_bench/tests/storage/exp_load_test.py +++ b/mlos_bench/mlos_bench/tests/storage/exp_load_test.py @@ -107,6 +107,7 @@ def test_exp_trial_update_categ( "kernel_sched_latency_ns": "2000000", "kernel_sched_migration_cost_ns": "-1", "vmSize": "Standard_B4ms", + "123": 2, } ], [{"score": "99.9", "benchmark": "test"}], diff --git a/mlos_bench/mlos_bench/tests/tunable_groups_fixtures.py b/mlos_bench/mlos_bench/tests/tunable_groups_fixtures.py index 003d31c993c..affec0bebb0 100644 --- a/mlos_bench/mlos_bench/tests/tunable_groups_fixtures.py +++ b/mlos_bench/mlos_bench/tests/tunable_groups_fixtures.py @@ -66,6 +66,17 @@ "log": false } } + }, + "integer_keyed": { + "cost": 0, + "params": { + "123": { + "description": "A parameter with an integer key", + "type": "int", + "default": 2, + "range": [1, 3] + } + } } } """ diff --git a/mlos_bench/mlos_bench/tests/tunables/tunable_to_configspace_test.py b/mlos_bench/mlos_bench/tests/tunables/tunable_to_configspace_test.py index 55bc1301226..b3792e73b5b 100644 --- a/mlos_bench/mlos_bench/tests/tunables/tunable_to_configspace_test.py +++ b/mlos_bench/mlos_bench/tests/tunables/tunable_to_configspace_test.py @@ -91,6 +91,12 @@ def configuration_space() -> ConfigurationSpace: weights=[0.5, 0.5], default_value=TunableValueKind.SPECIAL, ), + UniformIntegerHyperparameter( + name="123", + lower=1, + upper=3, + default_value=2, + ), ] ) spaces.add( diff --git a/mlos_bench/mlos_bench/tests/tunables/tunables_str_test.py b/mlos_bench/mlos_bench/tests/tunables/tunables_str_test.py index 61514c605bd..5fe73f1a5f3 100644 --- a/mlos_bench/mlos_bench/tests/tunables/tunables_str_test.py +++ b/mlos_bench/mlos_bench/tests/tunables/tunables_str_test.py @@ -17,6 +17,17 @@ def test_tunable_groups_str(tunable_groups: TunableGroups) -> None: # Same as `tunable_groups` (defined in the `conftest.py` file), but in different order: tunables_other = TunableGroups( { + "integer_keyed": { + "cost": 0, + "params": { + "123": { + "description": "A parameter with an integer key", + "type": "int", + "default": 2, + "range": [1, 3], + } + }, + }, "kernel": { "cost": 1, "params": {