From 04ae61b2f4e980b54914a011070cf2b3884d3710 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 17 Nov 2023 21:43:05 +0000 Subject: [PATCH 1/3] test integer keyed params --- mlos_bench/mlos_bench/tests/conftest.py | 11 +++++++++++ .../tests/tunables/tunable_to_configspace_test.py | 2 ++ .../mlos_bench/tests/tunables/tunables_str_test.py | 11 +++++++++++ 3 files changed, 24 insertions(+) diff --git a/mlos_bench/mlos_bench/tests/conftest.py b/mlos_bench/mlos_bench/tests/conftest.py index e3e29658984..bf38712a1dd 100644 --- a/mlos_bench/mlos_bench/tests/conftest.py +++ b/mlos_bench/mlos_bench/tests/conftest.py @@ -69,6 +69,17 @@ "range": [0, 1000000000] } } + }, + "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 3b7085f5ff9..c8fef5e6e33 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 @@ -38,12 +38,14 @@ def configuration_space() -> ConfigurationSpace: "idle": ["halt", "mwait", "noidle"], "kernel_sched_migration_cost_ns": (-1, 500000), "kernel_sched_latency_ns": (0, 1000000000), + "123": (1, 3), }) spaces["vmSize"].default_value = "Standard_B4ms" spaces["idle"].default_value = "halt" spaces["kernel_sched_migration_cost_ns"].default_value = -1 spaces["kernel_sched_latency_ns"].default_value = 2000000 + spaces["123"].default_value = 2 return spaces 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 3482532629c..4f21d0ef5b2 100644 --- a/mlos_bench/mlos_bench/tests/tunables/tunables_str_test.py +++ b/mlos_bench/mlos_bench/tests/tunables/tunables_str_test.py @@ -18,6 +18,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": { From c880d5ff9461674a5525dc88bd6d0d5ec028cb5f Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 17 Nov 2023 21:47:35 +0000 Subject: [PATCH 2/3] test fixup --- mlos_bench/mlos_bench/tests/storage/exp_load_test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 704715bd6bd..293332cf177 100644 --- a/mlos_bench/mlos_bench/tests/storage/exp_load_test.py +++ b/mlos_bench/mlos_bench/tests/storage/exp_load_test.py @@ -94,7 +94,8 @@ def test_exp_trial_update_categ(exp_storage_memory_sql: Storage.Experiment, 'idle': 'halt', 'kernel_sched_latency_ns': '2000000', 'kernel_sched_migration_cost_ns': '-1', - 'vmSize': 'Standard_B4ms' + 'vmSize': 'Standard_B4ms', + '123': '2', }], [99.9], [Status.SUCCEEDED] From 7d3c5fca063a1f1e44154d4d58012a3abdabb51f Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 17 Nov 2023 22:00:43 +0000 Subject: [PATCH 3/3] wip: fix more tests to include the integer parameter --- mlos_bench/mlos_bench/tests/optimizers/mock_opt_test.py | 4 ++++ .../mlos_bench/tests/optimizers/opt_bulk_register_test.py | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) 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 5f186d4596f..7617cf8efd0 100644 --- a/mlos_bench/mlos_bench/tests/optimizers/mock_opt_test.py +++ b/mlos_bench/mlos_bench/tests/optimizers/mock_opt_test.py @@ -21,18 +21,21 @@ def mock_configurations_no_defaults() -> list: """ return [ ({ + "123": 2, "vmSize": "Standard_B4ms", "idle": "halt", "kernel_sched_migration_cost_ns": 13111, "kernel_sched_latency_ns": 796233790, }, 88.88), ({ + "123": 3, "vmSize": "Standard_B2ms", "idle": "halt", "kernel_sched_migration_cost_ns": 117025, "kernel_sched_latency_ns": 149827706, }, 66.66), ({ + "123": 1, "vmSize": "Standard_B4ms", "idle": "halt", "kernel_sched_migration_cost_ns": 354784, @@ -48,6 +51,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 e9967776955..71619224006 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 @@ -25,24 +25,28 @@ def mock_configs() -> List[dict]: """ 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': 100000, 'kernel_sched_latency_ns': 3000000, }, { + '123': 2, 'vmSize': 'Standard_B2s', 'idle': 'mwait', 'kernel_sched_migration_cost_ns': 200000, @@ -109,7 +113,8 @@ def _test_opt_update_max(opt: Optimizer, configs: List[dict], "vmSize": "Standard_B2s", "idle": "mwait", "kernel_sched_migration_cost_ns": 200000, - 'kernel_sched_latency_ns': 4000000, + "kernel_sched_latency_ns": 4000000, + "123": 2, }