Coverage for mlos_bench/mlos_bench/run.py: 100%
14 statements
« prev ^ index » next coverage.py v7.5.1, created at 2024-05-05 00:36 +0000
« prev ^ index » next coverage.py v7.5.1, created at 2024-05-05 00:36 +0000
1#!/usr/bin/env python3
2#
3# Copyright (c) Microsoft Corporation.
4# Licensed under the MIT License.
5#
6"""
7OS Autotune main optimization loop.
9Note: this script is also available as a CLI tool via pip under the name "mlos_bench".
11See `--help` output for details.
12"""
14import logging
15from typing import List, Optional, Tuple
17from mlos_bench.launcher import Launcher
18from mlos_bench.tunables.tunable_groups import TunableGroups
20_LOG = logging.getLogger(__name__)
23def _main(argv: Optional[List[str]] = None) -> Tuple[Optional[float], Optional[TunableGroups]]:
25 launcher = Launcher("mlos_bench", "Systems autotuning and benchmarking tool", argv=argv)
27 with launcher.scheduler as scheduler_context:
28 scheduler_context.start()
29 scheduler_context.teardown()
31 (score, _config) = result = launcher.scheduler.get_best_observation()
32 # NOTE: This log line is used in test_launch_main_app_* unit tests:
33 _LOG.info("Final score: %s", score)
34 return result
37if __name__ == "__main__":
38 _main()