Skip to content

Commit

Permalink
Remove + operators from multiline string concats (#922)
Browse files Browse the repository at this point in the history
# Pull Request

## Title

Remove + operators from multiline string concats

---

## Description

- Closes #919 

---

## Type of Change

- 🔄 Refactor

---
  • Loading branch information
bpkroth authored Jan 11, 2025
1 parent f4d13dd commit d32c158
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
32 changes: 16 additions & 16 deletions mlos_bench/mlos_bench/tests/launcher_parse_args_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ def test_launcher_args_parse_1(config_paths: list[str]) -> None:
+ " ".join(config_paths)
+ " --num-trial-runners 5"
+ " --service services/remote/mock/mock_auth_service.jsonc"
+ " services/remote/mock/mock_remote_exec_service.jsonc"
+ " --scheduler schedulers/sync_scheduler.jsonc"
+ f" --environment {ENV_CONF_PATH}"
+ " --globals globals/global_test_config.jsonc"
+ " --globals globals/global_test_extra_config.jsonc"
" services/remote/mock/mock_remote_exec_service.jsonc"
" --scheduler schedulers/sync_scheduler.jsonc"
f" --environment {ENV_CONF_PATH}"
" --globals globals/global_test_config.jsonc"
" --globals globals/global_test_extra_config.jsonc"
" --test_global_value_2 from-args"
)
launcher = _get_launcher(__name__, cli_args)
Expand Down Expand Up @@ -203,15 +203,15 @@ def test_launcher_args_parse_2(config_paths: list[str]) -> None:
cli_args = (
" ".join([f"--config-path {config_path}" for config_path in config_paths])
+ f" --config {config_file}"
+ " --service services/remote/mock/mock_auth_service.jsonc"
+ " --service services/remote/mock/mock_remote_exec_service.jsonc"
+ f" --globals {globals_file}"
+ " --experiment_id MockeryExperiment"
+ " --no-teardown"
+ " --random-init"
+ " --random-seed 1234"
+ " --trial-config-repeat-count 5"
+ " --max_trials 200"
" --service services/remote/mock/mock_auth_service.jsonc"
" --service services/remote/mock/mock_remote_exec_service.jsonc"
f" --globals {globals_file}"
" --experiment_id MockeryExperiment"
" --no-teardown"
" --random-init"
" --random-seed 1234"
" --trial-config-repeat-count 5"
" --max_trials 200"
)
launcher = _get_launcher(__name__, cli_args)
# Check some additional features of the the parent service
Expand Down Expand Up @@ -294,8 +294,8 @@ def test_launcher_args_parse_3(config_paths: list[str]) -> None:
cli_args = (
" ".join([f"--config-path {config_path}" for config_path in config_paths])
+ f" --config {config_file}"
+ f" --globals {globals_file}"
+ " --max-suggestions 10" # check for - to _ conversion too
f" --globals {globals_file}"
" --max-suggestions 10" # check for - to _ conversion too
)
launcher = _get_launcher(__name__, cli_args)

Expand Down
20 changes: 10 additions & 10 deletions mlos_bench/mlos_bench/tests/launcher_run_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ def _launch_main_app(
(return_code, _stdout, _stderr) = local_exec_service.local_exec(
[
"./mlos_bench/mlos_bench/run.py"
+ " --config_path ./mlos_bench/mlos_bench/tests/config/"
+ f" {cli_config} --log_file '{log_path}'"
" --config_path ./mlos_bench/mlos_bench/tests/config/"
f" {cli_config} --log_file '{log_path}'"
],
cwd=root_path,
)
Expand Down Expand Up @@ -84,8 +84,8 @@ def test_launch_main_app_bench(root_path: str, local_exec_service: LocalExecServ
root_path,
local_exec_service,
" --config cli/mock-bench.jsonc"
+ " --trial_config_repeat_count 5"
+ " --mock_env_seed -1", # Deterministic Mock Environment.
" --trial_config_repeat_count 5"
" --mock_env_seed -1", # Deterministic Mock Environment.
[
f"^{_RE_DATE} run\\.py:\\d+ " + r"_main INFO Final score: \{'score': 67\.40\d+\}\s*$",
],
Expand All @@ -103,9 +103,9 @@ def test_launch_main_app_bench_values(
root_path,
local_exec_service,
" --config cli/mock-bench.jsonc"
+ " --tunable_values tunable-values/tunable-values-example.jsonc"
+ " --trial_config_repeat_count 5"
+ " --mock_env_seed -1", # Deterministic Mock Environment.
" --tunable_values tunable-values/tunable-values-example.jsonc"
" --trial_config_repeat_count 5"
" --mock_env_seed -1", # Deterministic Mock Environment.
[
f"^{_RE_DATE} run\\.py:\\d+ " + r"_main INFO Final score: \{'score': 67\.11\d+\}\s*$",
],
Expand All @@ -120,9 +120,9 @@ def test_launch_main_app_opt(root_path: str, local_exec_service: LocalExecServic
root_path,
local_exec_service,
"--config cli/mock-opt.jsonc"
+ " --trial_config_repeat_count 3"
+ " --max_suggestions 3"
+ " --mock_env_seed 42", # Noisy Mock Environment.
" --trial_config_repeat_count 3"
" --max_suggestions 3"
" --mock_env_seed 42", # Noisy Mock Environment.
[
# Iteration 1: Expect first value to be the baseline
f"^{_RE_DATE} mlos_core_optimizer\\.py:\\d+ "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ def __init__(
if n_random_init > 0.25 * max_trials and max_ratio is None:
warning(
"Number of random initial configs (%d) is "
+ "greater than 25%% of max_trials (%d). "
+ "Consider setting max_ratio to avoid SMAC overriding n_random_init.",
"greater than 25%% of max_trials (%d). "
"Consider setting max_ratio to avoid SMAC overriding n_random_init.",
n_random_init,
max_trials,
)
Expand Down

0 comments on commit d32c158

Please sign in to comment.