Skip to content

Commit f2b3e81

Browse files
Various documentation improvements (#912)
# Pull Request ## Title Various documentation improvements --- ## Description - [x] Some spelling fixups - [x] sidebar navigation depth tweaks - [x] Tunables improvements - [x] Split type related things out from tunable.py to tunable_types.py - [x] Associated import fixups - [x] Add Examples to Tunable class - [x] Optimizer documentation improvements - [x] Add more examples - [x] Add more cross references - [x] "See Also" rendering mixups. - [x] mlos_viz dabl doc fixups - [x] LlamaTune doc fixups - [ ] ~Environments~ (future PR) - [ ] ~Services~ (future PR) - [x] Disable Azure intersphinx resolution: Azure/azure-sdk-for-python#39316, Quansight-Labs/intersphinx_registry#57 See Also: #891 --- ## Type of Change - Documentation update - Refactor --- --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 6b30ee0 commit f2b3e81

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2005
-361
lines changed

.cspell.json

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"iloc",
3636
"ipykernel",
3737
"iterrows",
38+
"jsons",
3839
"jsonschema",
3940
"jupyterlab",
4041
"keepalive",

doc/nginx-docker.sh

+11-7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ scriptpath=$(readlink -f "$0")
1212
scriptdir=$(dirname "$scriptpath")
1313
cd "$scriptdir"
1414

15+
SKIP_NGINX_BUILD=${SKIP_NGINX_BUILD:-false}
16+
1517
if [ -f ../.devcontainer/.env ]; then
1618
source ../.devcontainer/.env
1719
fi
@@ -28,13 +30,15 @@ cmd="${1:-}"
2830
if [ "$cmd" == 'start' ]; then
2931
set -x
3032
tmpdir=$(mktemp -d)
31-
docker build --progress=plain -t mlos-doc-nginx \
32-
--build-arg http_proxy=${http_proxy:-} \
33-
--build-arg https_proxy=${https_proxy:-} \
34-
--build-arg no_proxy=${no_proxy:-} \
35-
--build-arg NGINX_PORT=$NGINX_PORT \
36-
-f Dockerfile "$tmpdir"
37-
rmdir "$tmpdir"
33+
if ! $SKIP_NGINX_BUILD; then
34+
docker build --progress=plain -t mlos-doc-nginx \
35+
--build-arg http_proxy=${http_proxy:-} \
36+
--build-arg https_proxy=${https_proxy:-} \
37+
--build-arg no_proxy=${no_proxy:-} \
38+
--build-arg NGINX_PORT=$NGINX_PORT \
39+
-f Dockerfile "$tmpdir"
40+
rmdir "$tmpdir"
41+
fi
3842
docker run -d --name mlos-doc-nginx \
3943
-v "$repo_root/doc/nginx-default.conf":/etc/nginx/templates/default.conf.template \
4044
-v "$repo_root/doc":/doc \

doc/source/conf.py

+16-3
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,10 @@ def is_on_github_actions():
136136
intersphinx_mapping = get_intersphinx_mapping(
137137
packages={
138138
"asyncssh",
139-
"azure-core",
140-
"azure-identity",
139+
# Azure SDKs removed their intersphinx publishing.
140+
# https://github.com/Azure/azure-sdk-for-python/issues/39316
141+
# "azure-core",
142+
# "azure-identity",
141143
"configspace",
142144
"matplotlib",
143145
"numpy",
@@ -166,12 +168,15 @@ def is_on_github_actions():
166168
("ConcreteOptimizer", "class"): "data",
167169
("ConcreteSpaceAdapter", "class"): "data",
168170
("DistributionName", "class"): "data",
171+
("mlos_bench.tunables.tunable_types.DistributionName", "class"): "data",
169172
("FlamlDomain", "class"): "data",
170173
("mlos_core.spaces.converters.flaml.FlamlDomain", "class"): "data",
171174
("TunableValue", "class"): "data",
172-
("mlos_bench.tunables.tunable.TunableValue", "class"): "data",
175+
("mlos_bench.tunables.tunable_types.TunableValue", "class"): "data",
173176
("TunableValueType", "class"): "data",
177+
("mlos_bench.tunables.tunable_types.TunableValueType", "class"): "data",
174178
("TunableValueTypeName", "class"): "data",
179+
("mlos_bench.tunables.tunable_types.TunableValueTypeName", "class"): "data",
175180
("T_co", "class"): "data",
176181
("CoroReturnType", "class"): "data",
177182
("FutureReturnType", "class"): "data",
@@ -230,6 +235,9 @@ def setup(app: SphinxApp) -> None:
230235
nitpick_ignore_regex = [
231236
# Ignore some external references that don't use sphinx for their docs.
232237
(r"py:.*", r"flaml\..*"),
238+
# Azure SDKs removed their intersphinx publishing.
239+
# https://github.com/Azure/azure-sdk-for-python/issues/39316
240+
(r"py:.*", r"azure\..*"),
233241
]
234242

235243
# Which documents to include in the build.
@@ -295,6 +303,11 @@ def setup(app: SphinxApp) -> None:
295303
#
296304
html_theme = "sphinx_rtd_theme"
297305

306+
html_theme_options = {
307+
"canonical_url": "https://microsoft.github.io/MLOS/",
308+
"navigation_depth": -1,
309+
}
310+
298311
# Add any paths that contain custom static files (such as style sheets) here,
299312
# relative to this directory. They are copied after the builtin static files,
300313
# so a file named "default.css" will overwrite the builtin "default.css".

doc/source/index.rst

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ MLOS Documentation
1010

1111
Documentation is generated from both the `source tree markdown <source_tree_docs/index.html>`_ and the Python docstrings for each of the packages with navigation links on the side.
1212

13+
MLOS also has a fairly large test suite, so when in doubt, check the `code <https://github.com/microsoft/MLOS>`_ for additional examples or reach out to the maintainers on `Github <https://github.com/microsoft/MLOS>`_!
14+
1315
.. toctree::
1416
:caption: Source Tree Documentation
1517
:maxdepth: 4

mlos_bench/mlos_bench/__init__.py

+15-10
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
``mlos_bench`` can be installed from `pypi <https://pypi.org/project/mlos-bench>`_
1616
via ``pip install mlos-bench`` and executed using the ``mlos_bench`` `command
1717
<../../mlos_bench.run.usage.html>`_ using a collection of `json` `configs
18-
<https://github.com/microsoft/MLOS/tree/main/mlos_bench/mlos_bench/config/>`_.
18+
<https://github.com/microsoft/MLOS/tree/main/mlos_bench/mlos_bench/config/>`_
19+
which are managed and documented in the :py:mod:`~mlos_bench.config` module and
20+
elsewhere in this package documentation.
1921
2022
It is intended to be used with :py:mod:`mlos_core` via
2123
:py:class:`~mlos_bench.optimizers.mlos_core_optimizer.MlosCoreOptimizer` to help
@@ -59,8 +61,9 @@
5961
benchmarking environments or autotuning experiments.
6062
6163
Where possible, the framework will provide common configs for reuse (e.g., deploying
62-
a VM on Azure, or run benchbase against a database system) to allow users to focus
63-
on the specifics of their experiments.
64+
a VM on Azure, or run `benchbase <https://github.com/cmu-db/benchbase>`_ against
65+
a database system) to allow users to focus on the specifics of their
66+
experiments.
6467
6568
Where none are currently available, one can create them external to MLOS, however
6669
users are also encouraged to `submit PRs or Issues
@@ -125,18 +128,20 @@
125128
harder to scale to many users.
126129
127130
With these features as a part of the MLOS ecosystem, benchmarking can become a
128-
*service* that any developer, admin, research, etc. can use and adapt.
131+
*service* that any developer, admin, researcher, etc. can use and adapt.
129132
130133
See below for more information on the classes in this package.
131134
132135
Notes
133136
-----
134-
Note that while the docstrings in this package are generated from the source code
135-
and hence sometimes more focused on the implementation details, most user
136-
interactions with the package will be through the `json configs
137-
<https://github.com/microsoft/MLOS/tree/main/mlos_bench/mlos_bench/config/>`_. Even
138-
so it may be useful to look at the source code to understand how those are
139-
interpreted.
137+
Note that while the docstrings in this package are generated from the source
138+
code and hence sometimes more focused on the implementation details, we do try
139+
to provide some (testable) examples here, but most user interactions with the
140+
package will be through the `json configs
141+
<https://github.com/microsoft/MLOS/tree/main/mlos_bench/mlos_bench/config/>`_.
142+
Even so it may be useful to look at the documentation here (perhaps especially
143+
starting with :py:mod:`mlos_bench.config`) and, if necessary, the `source code
144+
<https://github.com/microsoft/MLOS>`_ to understand how those are interpreted.
140145
141146
Examples
142147
--------

mlos_bench/mlos_bench/config/__init__.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,14 @@
208208
Here is a list of some well known variables that are provided or required by the
209209
system and may be used in the config files:
210210
211-
- ``$experiment_id``: A unique identifier for the experiment.
211+
- ``$experiment_id``: A unique identifier for the ``Experiment``.
212212
Typically provided in globals.
213-
- ``$trial_id``: A unique identifier for the trial currently being executed.
213+
- ``$trial_id``: A unique identifier for the ``Trial`` currently being executed.
214214
This can be useful in the configs for :py:mod:`mlos_bench.environments` for
215215
instance (e.g., when writing scripts).
216-
- TODO: Document more variables here.
216+
- ``$trial_runner_id``: A unique identifier for the ``TrialRunner``.
217+
This can be useful when running multiple trials in parallel (e.g., to
218+
provision a numbered VM per worker).
217219
218220
Tunable Configs
219221
^^^^^^^^^^^^^^^

mlos_bench/mlos_bench/config/schemas/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
88
See Also
99
--------
10-
mlos_bench.config.schemas.config_schemas : The module handling the actual schema
11-
definitions and validation.
10+
mlos_bench.config.schemas.config_schemas :
11+
The module handling the actual schema definitions and validation.
1212
"""
1313

1414
from mlos_bench.config.schemas.config_schemas import CONFIG_SCHEMA_DIR, ConfigSchema

mlos_bench/mlos_bench/environments/__init__.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,12 @@
116116
117117
See Also
118118
--------
119-
:py:mod:`mlos_bench.config` : Overview of the configuration system.
120-
:py:mod:`mlos_bench.services` : Overview of the Services available to the
121-
Environments and their configurations.
122-
:py:mod:`mlos_bench.tunables` : Overview of the Tunables available to the
123-
Environments and their configurations.
119+
:py:mod:`mlos_bench.config` :
120+
Overview of the configuration system.
121+
:py:mod:`mlos_bench.services` :
122+
Overview of the Services available to the Environments and their configurations.
123+
:py:mod:`mlos_bench.tunables` :
124+
Overview of the Tunables available to the Environments and their configurations.
124125
"""
125126

126127
from mlos_bench.environments.base_environment import Environment

mlos_bench/mlos_bench/environments/base_environment.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
from mlos_bench.dict_templater import DictTemplater
2020
from mlos_bench.environments.status import Status
2121
from mlos_bench.services.base_service import Service
22-
from mlos_bench.tunables.tunable import TunableValue
2322
from mlos_bench.tunables.tunable_groups import TunableGroups
23+
from mlos_bench.tunables.tunable_types import TunableValue
2424
from mlos_bench.util import instantiate_from_config, merge_parameters
2525

2626
if TYPE_CHECKING:

mlos_bench/mlos_bench/environments/composite_env.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
from mlos_bench.environments.base_environment import Environment
1313
from mlos_bench.environments.status import Status
1414
from mlos_bench.services.base_service import Service
15-
from mlos_bench.tunables.tunable import TunableValue
1615
from mlos_bench.tunables.tunable_groups import TunableGroups
16+
from mlos_bench.tunables.tunable_types import TunableValue
1717

1818
_LOG = logging.getLogger(__name__)
1919

mlos_bench/mlos_bench/environments/local/local_env.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
from mlos_bench.environments.status import Status
2626
from mlos_bench.services.base_service import Service
2727
from mlos_bench.services.types.local_exec_type import SupportsLocalExec
28-
from mlos_bench.tunables.tunable import TunableValue
2928
from mlos_bench.tunables.tunable_groups import TunableGroups
29+
from mlos_bench.tunables.tunable_types import TunableValue
3030
from mlos_bench.util import datetime_parser, path_join
3131

3232
_LOG = logging.getLogger(__name__)

mlos_bench/mlos_bench/environments/local/local_fileshare_env.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
from mlos_bench.services.base_service import Service
1818
from mlos_bench.services.types.fileshare_type import SupportsFileShareOps
1919
from mlos_bench.services.types.local_exec_type import SupportsLocalExec
20-
from mlos_bench.tunables.tunable import TunableValue
2120
from mlos_bench.tunables.tunable_groups import TunableGroups
21+
from mlos_bench.tunables.tunable_types import TunableValue
2222

2323
_LOG = logging.getLogger(__name__)
2424

mlos_bench/mlos_bench/environments/mock_env.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
from mlos_bench.environments.base_environment import Environment
1515
from mlos_bench.environments.status import Status
1616
from mlos_bench.services.base_service import Service
17-
from mlos_bench.tunables.tunable import Tunable, TunableValue
17+
from mlos_bench.tunables.tunable import Tunable
1818
from mlos_bench.tunables.tunable_groups import TunableGroups
19+
from mlos_bench.tunables.tunable_types import TunableValue
1920

2021
_LOG = logging.getLogger(__name__)
2122

mlos_bench/mlos_bench/environments/remote/remote_env.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
from mlos_bench.services.base_service import Service
2323
from mlos_bench.services.types.host_ops_type import SupportsHostOps
2424
from mlos_bench.services.types.remote_exec_type import SupportsRemoteExec
25-
from mlos_bench.tunables.tunable import TunableValue
2625
from mlos_bench.tunables.tunable_groups import TunableGroups
26+
from mlos_bench.tunables.tunable_types import TunableValue
2727

2828
_LOG = logging.getLogger(__name__)
2929

mlos_bench/mlos_bench/environments/script_env.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
from mlos_bench.environments.base_environment import Environment
1818
from mlos_bench.services.base_service import Service
19-
from mlos_bench.tunables.tunable import TunableValue
2019
from mlos_bench.tunables.tunable_groups import TunableGroups
20+
from mlos_bench.tunables.tunable_types import TunableValue
2121
from mlos_bench.util import try_parse_val
2222

2323
_LOG = logging.getLogger(__name__)

mlos_bench/mlos_bench/launcher.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
from mlos_bench.services.local.local_exec import LocalExecService
3030
from mlos_bench.services.types.config_loader_type import SupportsConfigLoading
3131
from mlos_bench.storage.base_storage import Storage
32-
from mlos_bench.tunables.tunable import TunableValue
3332
from mlos_bench.tunables.tunable_groups import TunableGroups
33+
from mlos_bench.tunables.tunable_types import TunableValue
3434
from mlos_bench.util import try_parse_val
3535

3636
_LOG_LEVEL = logging.INFO

0 commit comments

Comments
 (0)