Граф коммитов

74 Коммитов

Автор SHA1 Сообщение Дата
Brian Kroth d50f1f4e83
MacOS test fixups and CI pipelines (#876)
# Pull Request

## Title

Fixes some test issues for Mac OS environments and enables CI pipelines.

---

## Description

- [x] mypy fixups
- [x] Enable MacOS build pipeline
- [x] ~Enable MacOS devcontainer tests~
  - [x] ~Needs `docker` enabled (which isn't currently possible)~
- [x] ~Related: add *basic* devcontainer build test and run for Windows
as well (also isn't currently possible)~
- [x] Fixes MacOS tests
  - [x] Address parallel runner issues with output dir cleanup
  - [x] Fix ssh tests (also a parallelization issue)
- [x] ~Publish multi arch docker images (amd64 and arm64) (can't see
above)~

Closes #875 
  
---

## Type of Change

- 🛠️ Bug fix
-  New feature
- 🧪 Tests

---

## Testing

Locally tested on MacOS, Windows, and Linux.

---

## Additional Notes (optional)

Leaves some currently disabled stub code for creating devcontainers in
the future on MacOS and Windows hosts. Unfortunately this isn't
currently possible with the Github Action runners.


Also did some cosmetic renaming of the CI pipelines for better
descriptions.
This affects the required tests to pass in the repo settings.
Will adjust that after this is approved.

---
2024-11-05 11:24:50 -06:00
Brian Kroth 72e10d1833
devcontainer build fixups for macOS clients (#874)
# Pull Request

## Title

Fixups to the devcontainer build for macOS clients.

---

## Description

- Use a more portalable random number generator
- Address some differences in docker.sock privileges.
- Address differences in `stat` arguments.
- Switch to wget mode for conda installation to workaround lack of arm64
apt repo.
- When pulling base images to prime cache, use the appropriate
architecture (for Windows we only support amd64 for now).
- Remove `:latest` from `cache-from` args for `podman` compliance.
- Address some differences in `sed` syntax.

- Fixes #873 

---

## Type of Change

- 🛠️ Bug fix

---

## Testing

- local MacBook testing
- CI testing for Linux

---

## Additional Notes

Doesn't currently do builds for arm64 platform in the pipeline.
Can work towards addressing that in the future.
2024-10-21 10:17:37 -05:00
Brian Kroth 610341c203
Various quick CI fixups (#870)
# Pull Request

## Title

Quick fixups to the documentation build.

---

## Description

- Expands one of the ignored warnings.
- Reformats the sphinx conf for black and pylint.
- Removes a warning from that file around redefinition of
`html_theme_path`.
- Adds a dependency requirement tweak for `pyparsing` when installing
under python 3.8 (unrelated other CI bug).
- Adds a workaround to a mypy false positive with in checking `np.e` as
a "deleted variable" (e.g., `e` is used in a try/except block)

---

## Type of Change

- 🛠️ Bug fix
- 📝 Documentation update

---

## Testing

- Ran `make doc` and `make check-doc`.
- Ran `make notebook-exec-test`.

---

## Additional Notes (optional)

This is a quick fix to get the CI pipeline working again.
The more complete fix to remove warning ignores from doc generation,
improve cross reference linking, etc. will be handled later in #869

---
2024-10-14 16:25:10 -05:00
Brian Kroth 19c32babaa
Temporarily avoid new version of FLAML (#840)
See Also: #839

Also fixes `make dist-test` rules to workaround recently broken `pip`
version interpretation when using symlinked whl files.
2024-08-14 18:56:12 +00:00
Brian Kroth a4d21cd5e7
Fixups to example notebook for new APIs (#834)
- [x] enable notebook execution in CI pipelines to prevent these
mistakes in the future

---------

Co-authored-by: Sergiy Matusevych <sergiym@microsoft.com>
2024-08-07 16:20:17 -07:00
Brian Kroth f681cfd7a1
make doc CI fixups (#830)
Splitting out from #802 to benefit other jobs as well.
2024-08-01 13:00:00 -07:00
Brian Kroth f47e01fbcc
Convert .pylintrc file to pyproject.toml (#797)
Removes a dotfile from the root directory.

---------

Co-authored-by: Sergiy Matusevych <sergiym@microsoft.com>
2024-07-15 17:29:24 -05:00
Brian Kroth 4111c231bb
Bump version: 0.5.1 → 0.6.0 (#795)
Especially for build system updates.
2024-07-15 12:46:05 -05:00
Brian Kroth e40ac28317
Enable black, isort, and doc formatters and checks (#774)
Follow on work to #766.

This enabled both formatters and applies their changes to the repo.

Additionally, since `black` does not make changes to comments nor
docstrings, we also enable `docformatter` to reformat docstrings which
better aligns with `pydocstyle` rules as well.
Without this additional change (and some manual fixups), `pycodestyle`
and `pylint` would still complain about line lengths, for instance.

Finally, we make a minor adjustment to the max line length setting it to
99 (which is also accepted and mentioned in pep8) instead of 88 to avoid
some comment (especially linter overrides) wrapping.
2024-07-12 19:56:14 +00:00
Brian Kroth cef476c4c4
Prepare isort black formatters and checks (#766)
Builds off of #762, #763, and #764.

Prepares rules and configs to enable isort and black formatters and
checks but doesn't enable them yet.

After these are enabled (next PR) we will reformat all files and ignore
that revision in git blame configs.

Then, we can convert configs stored in `setup.cfg` and `.pylintrc` to
the top level `pyproject.toml` and remove the older configs.
2024-07-03 15:57:49 -05:00
Brian Kroth d428ce70fd
Introduce pyproject.toml build changes (#764)
This PR builds off of #762 and #763 

These are in part 
1. followup fixups for #746 (e.g., to allow setuptools-scm to be pulled
in at build time as a build dependency only when conda an pip have
mismatched version issues), and
2. Modernization improvements to allow us to make better use of other
tools (e.g., `black` that only accept `pyproject.toml` files as their
configuration files).

To do so, we move some configs from `setup.py` to `pyproject.toml` for
each module.
However, to retain the ability to rewrite URLs in published README.md
files on PyPi as well as consistent version dependencies across modules
without the need to manually specify version numbers (e.g., using
`setuptools-scm`) we mark a few dependencies as dynamic and leave our
existing logic inside the `setup.py` file.

Finally, we reorganize the `version.py` file to be inside the module and
fix a few previous omissions for `mlos_viz`.
2024-07-02 17:31:31 -05:00
Brian Kroth 7daf3faa77
Staged Makefile Improvements (#762)
- Introduce a new `make format` target that currently only calls
`licenseheaders` but will call `isort` and `black` in the future
- Introduce new variables to help make dependency tracking easier
- Simplify `pytest` rules and allow running only a single module at a
time.

This PR is a precursor to pyproject.toml related build changes as well.

---------

Co-authored-by: Sergiy Matusevych <sergiym@microsoft.com>
2024-07-01 10:57:17 -05:00
Brian Kroth 338b143541
CI fixups: changes in package naming via upstream libs (dash to underscore) (#733) 2024-05-10 15:31:37 -07:00
Brian Kroth 90bb6ee8cf
Omit tests from docs (#660)
Close #654
2024-02-01 14:43:54 -08:00
Brian Kroth a45f97dc01
Improve mlos-viz for multiple repeats of a config and add tests (#633)
- Mark `mlos_viz` as `typed` for `mypy`
- Bump version
- Mock calls to matplotlib/dabl for testing
- Add plotting of top-N configs
- Improve plots for handling repeat config trials via variance error
bars

---------

Co-authored-by: Sergiy Matusevych <sergiym@microsoft.com>
2024-01-28 17:46:44 -08:00
Brian Kroth 342eb5b259
PyPi publish makefile rules fixup (#640)
Prior Makefile rule consolidation tried to group dependencies for the
pattern rule into separate lines for readability, but apparently this
isn't allowed.

This minor changes separates those out into a variable we can reference
instead. Tested on a clean build tree locally.
2024-01-19 00:53:20 +00:00
Brian Kroth 1f3b26d9f0
Introduce basic experiment visualization module mlos_viz via dabl (#624)
Adds a basic `mlos_viz.plot(exp)` style API for simple visualizations of
`ExperimentData` results relative to the experiment's objectives
(building off of #628 and https://github.com/dabl/dabl/pull/335).

Note: this PR currently omits unit tests for the new module due to the
complexity of testing visualizations. We intend to add this in future
PRs. There is however, a working example of its use here right now:
https://github.com/Microsoft-CISL/sqlite-autotuning/pull/41

---------

Co-authored-by: Sergiy Matusevych <sergiy.matusevych@gmail.com>
2024-01-16 18:48:20 +00:00
Brian Kroth c7df7ff99a
Pypi packaging (#626)
Co-authored-by: Sergiy Matusevych <sergiy.matusevych@gmail.com>
2024-01-09 22:40:15 +00:00
Brian Kroth 59cc179a58
Enforce correct code coverage threshold (#615)
Corrects this error:

```
---------- coverage: platform linux, python 3.11.5-final-0 -----------
Coverage HTML written to dir htmlcov
Coverage XML written to file coverage.xml

Required test coverage of 0.92% reached. Total coverage: 93.12%
=========================== short test summary info ============================
```
2023-11-29 21:37:48 +00:00
Brian Kroth 6bb0124bf9
experiment_id documentation improvements (#601)
Closes #599
2023-11-20 14:50:49 -06:00
Brian Kroth 231c5e61e2
Some documentation fixups (#524)
- fix a quoting issue in an example
- cross link the `sqlite-autotuning` repo
- reuse the content from the main README.md's for the github pages site
- general improvements to the landing page docs

---------

Co-authored-by: Sergiy Matusevych <sergiym@microsoft.com>
2023-11-08 00:11:57 +00:00
Brian Kroth b4b5f9371b
Add RemoteEnv tests using SshService testing infrastructure (#557)
Adds tests for RemoteEnv `setup`, `run`, `teardown` using SshServices

Fixes some associated bugs:
- convert certain `SFTPError` exceptions to `FileNotFound` in
`SshFileShareService`
This is important for `LocalFileShareEnv` integration especially since
it always calls `download` during calls to `status`, but only handles
`FileNotFound` exceptions when `ignore_missing=True`
- Fixups to #517 for `download`, `upload` to connect via `self._params`
(loaded from the `required_args`) instead of `self.config`

Also included:
- basic configs for SshServices and LocalExec for easy inclusion

Closes #521

---------

Co-authored-by: Sergiy Matusevych <sergiym@microsoft.com>
Co-authored-by: Sergiy Matusevych <sergiy.matusevych@gmail.com>
2023-11-01 23:25:24 +00:00
Brian Kroth 6d6f897808
Add checks for test count (#562)
and increase code coverage requirements

- [ ] Check the Windows and Linux CI count too?
2023-10-27 14:54:44 -07:00
Brian Kroth 142271a80a
Fix intermittent MagickMock response unit test error (#545)
Fixes a bug with mock responses not providing a `json()` method which is
only called during debug logging.

This was somewhat randomly showing up based I think upon the order of
the tests running.
One of them, seemed to be enabling `_LOG.setLevel(logging.DEBUG)` so
that future tests (for that worker) would also have the level set.

Once done, additional paths would be followed inside the `AzureServices`
code that caused it to try and do something like the following
`_LOG.debug(response.json())` which would fail because the mocked
response object didn't provide a `json()` method response.

This fixes that error, but doesn't address the `debug` log ordering.
I'm not certain we should switch all of our unit tests over to running
in DEBUG mode by default since it might cause us to depend on that
behavior.
As a compromise, for now I've enabled it only inside
`.vscode/settings.json` so that when we run `pytest` interactively
(e.g., during dev cycle or while debugging a single unit test), then
those code paths will be followed.

We can also run the following on demand and incorporate it to our
`Makefile` or nightly runs to do it at least some of the time:

```sh
pytest --log-level=DEBUG
```

or

```sh
export PYTEST_EXTRA_OPTIONS=--log-level=DEBUG
make test
```
2023-10-18 15:44:49 -07:00
Brian Kroth 13c62caae7
Add some additional conda dependencies to build wheels (#519)
Fixes some uncached rebuild issues that are holding up some other PRs.
2023-09-28 22:25:02 +00:00
Brian Kroth d2aa3a6ceb
CI fixups (#508)
- Permissions fixup
- Slight modification to `licenseheaders` rule for more file types.
  See Also: https://github.com/johann-petrak/licenseheaders/pull/78
2023-09-18 10:40:29 -07:00
Brian Kroth f7348f1c23
mlos_bench config json schema validation - services (#368)
Extends #340, #346, #349, #352, #359 to Service configs.
See Also: #331 

- [x] main schema as a set of subschemas
- [x] connect schema validation in the mlos_bench code
- [x] test-cases

To do this we removed support for configs that were flat lists of service configs: `[ {"class": "service.class"} ]` and turned those into objects that have a single key `"services"` with the list instead. `{ "services": [ ... ] }`
This makes sure that all configs are dicts/objects that we can optionally put `"$schema"` attributes on but also simplifies some of the config loading logic.
2023-05-22 15:31:16 -05:00
Brian Kroth e5a8bde5a5
devcontainer style improvements (#358)
* Disable line buffering
* fail pylint checks on unused-import errors
* make sure pycodestyle checks for indentation
* increase code quality requirements
* add some new extensions
* bring pycodestyle checks inline with flake8
* add a prettier rc that instructs it to use our editorconfig

---------

Co-authored-by: Sergiy Matusevych <sergiym@microsoft.com>
2023-05-15 22:19:20 +00:00
Brian Kroth 16504e29b6
Refactor config examples directory structure (#313)
* reorg examples/configs to a more consistent layout and start documenting it
* include the config examples in the package
* distribute the config directory
* fixups to exclude tests from the wheel file
* also exclude the test files even from the sdist tars
* test that the configs got included in the wheel
* automatically add the modules included configs to the search path
* fix inconsistent plurals
* add conditional dependency for importlib_resources for python 3.8
* adding mock vm ops services
* make the publicly accessible version a property
* allow llamma tune to always reverse the default config
* handle null categorical values and disallow duplicate values
* add local mock exec service
* more mock services and tunables fixups
* pylint fixups, spelling, more tests for tunable groups loading, and make tunable groups indexable by tunable as well as by name
* merge tunables upstream only
* splitting out tweaks to covariant group names and null value processing for tunables
* add a test for duplicate values being disallowed
* adding some tests for changes to tunable assignment/definition behavior
* mypy cleanup
* rework covariant group merge compatibility check
* return None not 'None'
* fixup score calc
2023-05-03 15:45:50 -07:00
Brian Kroth 9a1b2e234b
Fixup Makefile parallel job support (#333)
- update Makefile rules to enable parallel runs again
- group output from each rule together so it's easier to spot errors
2023-05-03 13:12:03 -07:00
Brian Kroth 448141da81
Publish mlos_bench script (#325)
* fixup some markdown lint problems too
2023-05-01 21:00:24 -07:00
Brian Kroth a8f84f170f
Rename the conda env (#319)
* rename the conda env, which serves mlos_bench as much as mlos_core now, to just "mlos"
* add rename to the docker container - pulled from #313
2023-04-28 19:13:41 +00:00
Sergiy Matusevych 02e079f9b2
Unify run_opt and run_bench before implementing an uber-config (#317)
* Create a unified start script for both benchmarking and optimization
* split the Launcher constructor into several private methods
* update the README and doc index with the new script info
* update the Makefile to refer to the new launch script
2023-04-28 00:59:07 +00:00
Brian Kroth f7e6305ba5
Refactor for consistent use of plural submodule names (#318)
* Refactor for consistent use of plural submodule names (pulled out from work in #313)
2023-04-27 17:39:58 -07:00
Brian Kroth b5c528df58
Makefile bdist rule tweaks (#316)
Followup cleanup to #315
2023-04-25 16:46:16 -07:00
Brian Kroth f6058a1ed2
Fixups to exclude tests from the wheels (#315)
* fixups to exclude tests from the wheel file
* also exclude the test files even from the sdist tars
2023-04-25 13:31:28 -07:00
Brian Kroth 9fe180a9a5
mypy static type checking for mlos_bench (#306)
Adds static type checking via mypy for mlos_bench as well.

Builds on #305, #307

- [x] Add `Protocol`s for different `Service` types so `Environment`s can check that the appropriate `Service` mix-ins have been setup.
  - [x] Config Loader
  - [x] Local Exec
  - [x] Remote Exec
  - [x] Remote Fileshare
  - [x] VM Ops
    - [ ] Future PR: Split VM Ops to VM/Host and OS Ops (for local SSH support)
2023-04-19 18:28:38 +00:00
Brian Kroth 10e4fa5b91
Stricter mypy typing for mlos_core (#305)
* force function definitions to have type decorations

* type annotations

* ignore errors on listening to port 81 from 127.0.0.1 so we can run two devcontainer instances at a time

* more type check fixups

* ignore missing matplotlib stubs

* more typing

* spelling

* annotate test functions

* spelling

* types

* spelling

* more typing

* more typing fixups

* more strict

* more typing fixups

* fixups

* more

* spaces

* merge conflict fixups

* more merge conflicts

* fixup

* back that change out

* minor tweaks for unimplemented function

* fixups for py 3.89

* fixups for newer version of mypy

* minor tweaks to dmypy script

* update

---------

Co-authored-by: Sergiy Matusevych <sergiym@microsoft.com>
2023-04-17 14:01:27 -07:00
Brian Kroth 7487f22125
devcontainer nginx port fixups (#307)
* move nginx port to a random port

* make it work for powershell too

* need the .env file to be in a different directory

* fixups for pwsh

* also stop running the docker pull

* whitespace reorg

* fixup

* make the cmd more verbose

* more debugging

* ignore ipv6
2023-04-17 13:11:29 -07:00
Brian Kroth cac5351b98
mypy type checking support for mlos_core (mlos_bench to follow later) (#301)
* mypy type checking support for mlos_core (mlos_bench to follow later)
2023-04-12 16:11:58 +00:00
Brian Kroth a3a5ff889e
Devcontainer port conflict tweaks (#296)
Windows (or other platforms) may listen on port 80 and cause conflicts when WSL2 tries to forward ports for both sides so that `localhost` resolution behaves as expected despite the VM technically being a separate host.
When this happens the devcontainer can fail to start due to in ability for nginx docs container to listen on port 80.
To workaround this we simply tell it to listen on port 81 instead.  The devcontainer forwards the port to a different one on the host anyways.

Additionally, we document some commands for cleaning up stale container images in the ACR service to avoid excessive storage usage.
2023-04-07 10:12:50 -07:00
Brian Kroth 27715cc219
Automatic versioning support (#278)
* adding configs to be able to use bumpversion for managing versions

* Bump version: 0.0.4 → 0.1.0

* cleanup old file

* don't need to reinstall licenseheaders everytime if we include it in the conda env

* github actions checks out in shallow mode which setuptools-scm doesn't like, but doesn't cause issues, so we ignore the warning
2023-03-20 17:46:06 -05:00
Brian Kroth b848dd6ed3
enforce minimum code coverage (#279) 2023-03-20 13:46:14 -07:00
Brian Kroth a0a76cfcf6
Switch to Github Actions for CI/CD runs (#274) 2023-03-18 15:52:26 -05:00
Brian Kroth dbac3f4ddd Merged PR 1054: Prepwork for OSSing
- include some boilerplate from the original MLOS repo
- adding license headers on scripts
- add rules for checking licenseheaders
2023-03-17 21:20:39 +00:00
Brian Kroth f61b49383f Merged PR 1051: Consolidate some python tool dotfiles into setup.cfg 2023-03-17 18:16:09 +00:00
Brian Kroth 89bc4c5885 Merged PR 1026: Split test and check rules and improve test coverage publishing in pipelines and docs
- make test and check targets for mlos_core and mlos_bench independent for faster execution and more clear output for `make test` and `make check` iteration when only hacking on one module locally
  - ensures that the full set still runs in the pipeline though
- add support for skipping code coverage locally by setting `SKIP_COVERAGE=true` to run tests faster
- optionally copy the code coverage data into our static html site for publishing (plus nice badges)
- also, rather than racing and publishing the test results and code coverage for all of the different sub jobs, we only run and upload coverage via `pytest-azurepipelines` for the main one we're interested in to make reporting easier
  - also includes which job the test came from in the results
- some other general `Makefile` cleanup

Future work:
- [X] Split the single pipeline into two pipelines and make the Windows one optional
  (since it's usually the one that takes the longest and we care a little bit less about it now that we have decontainer support)
  !1040
2023-03-16 19:47:01 +00:00
Brian Kroth f11b6a93dd Merged PR 1001: Refactoring to place Services and Tunables in separate directories
Refactoring and documentation improvements.

- Makes more consistent layout matching of `mlos_bench` `tests` and source code directory layouts.
- Places `Services` into separate `mlos_bench.service` module structure.
  - Splits these out into separate `local` and `remote` ones, with `azure` being placed under the `remote` ones.
- Makes the `OSEnv` and `VMEnv` `Environments` more genericly `remote` environments.
  (they have nothing to do with Azure atm - that's all encapsulated by the `service.remote.azure` used to instantiate them)
- Places `Tunables` into separate `mlos_bench.tunables` module structure.
  - Splits multi-class `tunables.py` into multiple files.
- More consistent plural usage (e.g `environment` instead of `environments`).
- Adds `README.md` files to the directory structures.
- Requisite test, doc, etc. fixups to match these reorg.

This is all in preparation to add new SSH remote `Services`.

Additionally, I plan to make `wait_for_vm` more generically `wait_for_host` so that we can handle baremetal machines as well, but that can be a separate PR as it actually changes the API.
2023-03-11 02:26:35 +00:00
Brian Kroth 846e01e877 Merged PR 990: Try and use an inline container cache to speed up CI pipelines and reuse remotely built container locally 2023-03-09 02:58:39 +00:00
Sergiy Matusevych 8aa05128f3 Merged PR 939: 2. Unit tests for mlos_bench optimziation loop
also, reorganized unit tests for mlos_bench into groups for optimziers, environments, and tunable parameters
2023-03-03 22:53:37 +00:00