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

45 Коммитов

Автор SHA1 Сообщение Дата
Brian Kroth 0055a49fad
Add support for Python 3.13 and mark is as the expected default (#879)
# Pull Request

## Title

Add support for Python 3.13 and mark is as the expected default.

---

## Description

Upstream changed the default version of python, so this addresses
changes in checks in the pipelines.

So far it seems to "just work (tm)"

---

## Type of Change

- 🛠️ Bug fix
-  New feature
- 🧪 Tests

---

## Testing

Usual CI tests.

---
2024-10-31 13:46:43 -05:00
Brian Kroth 87381e328c
Temporarily avoid broken libpq conda package (#863)
Avoids the following error that results when the [latest
libpq](https://anaconda.org/conda-forge/libpq) (17.0) is installed from
conda-forge:

```
Error: pg_config --includedir is empty
```
2024-10-01 15:30:54 -07:00
Brian Kroth ff349f7db9
Fixup: use corrected python build package name from conda forge (#856)
The [`build`](https://anaconda.org/conda-forge/build) name in
conda-forge apparently hasn't been updated in 3 years.
Whereas [`python-build`](https://anaconda.org/conda-forge/python-build)
is updated frequently.
Probably this is for namespacing reasons.
2024-09-17 12:46:09 -07:00
Sergiy Matusevych 2e1eae30e3
Add CI build for Python 3.12 (#829)
This PR enables Python 3.12 in Windows environment and does not restrict
Python version in the default environments on Windows and Linux. Note
that although `mlos-3.12.yml` exists, its usage is still commented out
in `linux.yml`, because Python 3.12 is still not available on GitHub CI.
Issue #832 opened to track it

P.S. Also, we now use a lighter `matplotlib-base` instead of
`matplotlib` proper

~To be merged after #802~

---------

Co-authored-by: Brian Kroth <bpkroth@microsoft.com>
2024-08-06 10:09:02 -07:00
Brian Kroth 7fe167d8da
Restrict matplotlib version to < 3.9 for Windows conda env (#827)
Temporary fix to conda env to make it match the `pip` `setup.py`
restrictions for now.

Eventually, we'll wan to relax these, along with increased `numpy`
versions, etc.

See Also #826

---------

Co-authored-by: Sergiy Matusevych <sergiym@microsoft.com>
Co-authored-by: Sergiy Matusevych <sergiy.matusevych@gmail.com>
2024-08-02 17:16:33 -07:00
Sergiy Matusevych a5f36a85f2
Migrate to ConfigSpace 1.* (#802)
Summary of changes:
* [x] Update dependencies to ConfigSpace >= 1.0.
* [x] Update dependencies to SMAC3 >= 2.2.
* [x] Migrate to new ConfigSpace API.
* [x] Better definition of ConfigSpace fixture in unit tests.
* [x] Fix mypy and pylint issues triggered by the migration.

Notes:
* Side effect: **Works with Python 3.12!**
* ~Supersedes #799~
* ~Depends on upcoming SMAC3 release with [SMAC3
#1124](https://github.com/automl/SMAC3/pull/1124) merged in and a new
release cut with it.~
* Quantization will be added back later:
    * #803 
* ~Tests fail due to LlamaTune issue:~
    * #805 

Closes #727

---------

Co-authored-by: Brian Kroth <bpkroth@users.noreply.github.com>
Co-authored-by: Brian Kroth <bpkroth@microsoft.com>
2024-08-02 16:37:41 -07: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 a989d895e8
CI fixups (#783)
1. Temporarily avoid recent asyncssh version that breaks the tests
2. Workaround pylance issue with pyproject.toml related changes and pip
editable modules install format (#768)
   See Also: 
   - https://github.com/microsoft/pylance-release/issues/3473
   May also affect `mypy`:
   - https://github.com/python/mypy/issues/16988
   - https://github.com/python/mypy/issues/12313
2024-07-10 20:07:13 +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 a9cf8ca40e
Cascading series of CI dependency problems (#746)
A new git version outputs a different date format that older versions of
python's datetime module don't recognize.
https://github.com/pypa/setuptools_scm/issues/1038

setuptools-scm cut a new version to address that, but it's not available
in conda main channel yet, which is required, since without that the
conda pip phase can't execute in a single transaction

For now, we install things via conda-forge and adjust the channel
priority order so that the full set of dependencies could be resolved.

That of course brought in additional changes (e.g., `python=3.12` by
default, new `pylint`, `pycodestyle`, etc.), so this now also includes
some additional linting changes.

However, longer term, we need to switch to a pyproject.toml file to fix
this properly.
There we can specify prereqs for even loading the setup.py as well as
fix some other config complexities, though that is a broader change.

---------

Co-authored-by: Sergiy Matusevych <sergiym@microsoft.com>
2024-05-21 12:15:01 -07:00
Sergiy Matusevych 01f360b95a
use Python 3.11 in Windows conda env (#728)
a workaround for #727
2024-04-30 14:27:36 -05:00
Brian Kroth 28b07b192f
Conda Updates (#705)
- Update the base image and make sure related dependencies are
consistently from either pip or conda, but not both (follow on fixes to
#699)
- Minor tweak to include the PATH in the local script exec environment
variables
- Another fix to the CI issue in #703
2024-03-07 21:57:51 +00:00
Brian Kroth 0a0ed737eb
Address pandas warnings about future pyarrow requirements (#682)
Simply makes sure that pyarrow is available in the conda environment to
make some warnings go away.

Assumes that future versions of pandas will declare their own dependency
on pyarrow and this can be removed.

Also includes changes from #680

---------

Co-authored-by: Sergiy Matusevych <sergiym@microsoft.com>
2024-02-20 20:37:12 +00:00
Brian Kroth 626ad33526
New pytest version dependency tweaks (#681)
Fixups to #656 by switching to a new plugin and alerting to remove the
old one.

Includes changes from #680

---------

Co-authored-by: Sergiy Matusevych <sergiym@microsoft.com>
2024-02-20 19:50:08 +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 1f0f8ee441
Add SSH Support (#510)
- Adds SSH support for remote exec and file copy operations via
`asyncssy` library. Closes #379
- This requires an event loop thread to operate the async calls in the
background without blocking the rest of our main thread operations or
changing our APIs dramatically. Instead we interact with all operations
as futures after that.
- Add json schema config support for SSH

- Adds test infrastructure for running SSH servers inside containers via
`pytest-docker` which uses `docker compose` to start/stop them as
fixtures. This *should* work in all dev environments (Linux host, WSL
host, Windows host), but is quite sensitive to networking setups.

  - [x] test the background thread cleanup logic
  - [x] test error handling of a broken ssh endpoint
  - [x] test basic exec commands
  - [x] test host operations (e.g., reboot)
  - [x] test basic copy commands
  - [x] test for single connection reuse across services
  - [x] test multi-server support
  - [x] use random ports to avoid conflicts
  - provide some config examples for using this
  - add remote_env exec tests with this (increase code coverage)
    - Will do these in a future PR instead - #521

---------

Co-authored-by: Sergiy Matusevych <sergiym@microsoft.com>
Co-authored-by: Sergiy Matusevych <sergiy.matusevych@gmail.com>
2023-10-26 18:49:53 +00:00
Brian Kroth 9eeff6c63b
Add more mypy type stubs to the conda env (#534) 2023-10-10 21:30:58 +00: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 67a7d0a9a3
Autopep8 devcontainer fixups (#472)
The recommended autopep8 extension doesn't seem to be working for us:
https://github.com/microsoft/vscode-autopep8/issues/16

So, for now I'm reverting to the old way of doing things.

Also, the previous extension relied on a newer version of autopep8 than
conda was installing anyways, so I switched to installing it from pip.
2023-08-03 22:35:57 +00:00
Brian Kroth 1d4d62f8f8
Enable python 3.11 support (#436)
Closes #293

---------

Co-authored-by: Sergiy Matusevych <sergiym@microsoft.com>
2023-07-07 18:22:02 +00:00
Brian Kroth 44d180da2b
Unpin numpy dependencies (#433)
Unpins some dependencies at older versions.
Also fixes up a few more DeprecationWarnings.

Closes #401 
Closes #429 
Closes #295

---------

Co-authored-by: Sergiy Matusevych <sergiym@microsoft.com>
2023-07-05 17:47:53 +00:00
Brian Kroth 1582c6bab7
Remove Emukit Support to avoid GPy Issues (#428)
Removes Emukit to avoid GPy issues.  Closes #426
Switches most things to SMAC instead.

---------

Co-authored-by: Sergiy Matusevych <sergiym@microsoft.com>
2023-07-05 16:59:59 +00:00
Brian Kroth 0bc2069672
Windows CI and conda numpy version fixups (#423)
- Split out and fixup the build and dist-test script for Windows.
- Make sure conda isn't installing mismatch conda vs. pip versions.
- Add additional logs to help debug issues in the future.
2023-06-27 15:15:07 -05:00
Konstantinos Kanellis 1e6f563778
mlos_core: add SMAC optimizer (#341)
This PR addresses #294 and adds supports for [SMAC](https://automl.github.io/SMAC3/main/) optimizer in MLOS.
2023-06-14 14:22:59 -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 db1a0e359f
mlos_bench config json schema validation: optimizers and tunable_values (#340)
This PR introduces initial json schemas for mlos_bench optimizer configs and tunable_values configs, their validation at load time, and tests for both.

Future PRs will handle other config types.
See Also: #331
2023-05-15 16:30:36 -05:00
Brian Kroth 5b57d55319
Rework package dependencies (#320)
* rework package dependencies
2023-04-28 13:59:43 -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
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 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 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 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 8f73ecae7f Merged PR 903: Combination of additional build and doc fixups
This PR was originally aimed at just fixing the intermittent documentation build errors.
That issue ultimately stems from conflicts between conda and pip installs of two different versions of `mistune` dependency.
Along the way I found a handful of other improvements for build, pipeline, and documentation generation things.

- Make sure we do the nightly build regardless of whether code has changed
- Don't build the docs in parallel by default (trying to avoid an intermittent build failure)
- Add basic support for testing devcontainer manually outside for vscode
- Stop doing parallel builds so it's easier to debug, and move doc build/publishing to the devcontainer
- Split windows conda env off, stop using gpy from conda-forge, and just build it locally with clang, gcc, or msvc
- Adjust the devcontainer build so that more dependencies are built upfront during the container build.
  This makes the process more cacheable so that we can just pull the upstream version and not have to build as much locally which could delay first launch.
- Import part of a fix from elsewhere
- Switch to docker-compose style devcontainer that automatically also starts an nginx container for viewing the generated docs
- Update some docs and doc building
- [X] pydocstyle fixups
- [X] Add some log filtering of the `make doc` output for easier debugging
  (e.g. don't care about missing examples for now)
- [X] doc link lint checks
- DONE
- [X] Split this out into multiple PRs
  - [X] SpaceAdapterFactory: !959
  - [X] docstyle fixups: !960
  - [ ] doc build fixups
  - [ ] devcontainer improvements
(leaving the last two as this PR)
2023-02-27 05:42:22 +00:00
Brian Kroth 4ba5b9cbcf Merged PR 960: pydocstyle fixups
pydocstyle fixups
2023-02-25 01:07:34 +00:00
Brian Kroth aec20e9dd0 Merged PR 862: Add devcontainer support and other dev environment improvements
This PR is about general dev environment improvements.

Adds devcontainer support to help automatically prepare a dev environment inside either vscode of github codespaces.

The container is build, tested, and published to an ACR in the MlosCore RG during the pipeline for easy reuse and quick dev env boot strapping and reproducible environments both locally and remotely.

It also
- Enables parallel Makefile builds
- Adds additional helpful extensions to the vscode (e.g. copilot)
- Moves some pip package installs to conda for better reproducibility
- Fixes some issues regarding PYTHONPATH adjustment requirements for pytest and pylint.
- And, since I noticed a config for it in vscode, I added pydocstyle checks, though they aren't configured for blocking atm since there's lots of complaints.  Can decide whether to fix/force those later.
2023-02-07 21:43:01 +00:00
Brian Kroth e26f2919eb Merged PR 860: Various Build Fixups
- add nightly builds so we can catch issues with upstream changes sooner
- allow reading conda envs out of the environment
- handle only setting one of CONDA_EXPERIMENTAL_SOLVER and CONDA_SOLVER envs
- adjust conda envs to avoid python 3.11 for now
- adjust Makefile to use the same version of python from the current CONDA_ENV for our test environment
  (this is quick way to respect that version constraint and only specify it in one place)
- adjust the expected version of configspace
- remove configspace from conda env file
  (upstream doesn't have the version we need outside of conda-forge)
- move all other version restrictions to setup.py files
- add a 'full' mode for installing all extra_requires for each package
- use that in the conda envs instead

Related to additional build/test issues discovered in !850
2023-01-30 23:49:26 +00:00
Sergiy Matusevych b2b2e4f308 Merged PR 760: Implement LocalEnv and RemoteEnv and the related scripts
This is a final version of the benchmark stack that integrates both local (scheduler-side) and remote environments. Summary of changes:

* Implement `LocalEnv` to run custom scripts locally and exchange the data between the script and the framework.
* Implement `LocalFileShareEnv` that runs the scripts locally and uploads/downloads data to and from the shared storage.
* Refactor `AppEnv` into `RemoteEnv` to run the scripts on the remote VM; move the post-processing functionality (that runs locally) into `LocalEnv`.
* Allow stacking of multiple environments in one config file. This way we can have a single file for several environments that always go together (e.g., a sequence of: generate data locally -> upload to shared storage -> apply the configuration on a remote VM -> run the benchmark -> download the results -> process the data locally).
* Implement `require` keyword for `const_args` that are defined externally (e.g., the security credentials).
* Update the benchmarking scripts to work with the new setup.
* Minor improvements:
    * Use `JSON5` and `.jsonc` extension for our config files (so that we can have comments in JSON!)
    * Actually add comments to our JSON configs :)
    * Introduce the `--log-level` option and set the default logging level to `INFO`
    * Small fixes to logging, docstrings, and such

Related work items: #600
2022-12-08 18:37:19 +00:00
Eu Jing Chua e3534ca461 Merged PR 714: Implement azure fileshare as a service
Wrap up interactions with the Azure file share as a Service to use within mlos_bench.
Includes methods for uploading and downloading folders to / from the file share.

Related work items: #599
2022-11-01 22:09:18 +00:00
Brian Kroth 176dd1d230 Merged PR 610: Adding more codestyle checkers and fixups
pylint apparently removed the bad-whitespace check at some point [1]

This adds pycodestyle back to the mix to check for it.

[1] https://github.com/PyCQA/pylint/issues/3512
2022-09-02 18:58:49 +00:00
Brian Kroth c862e10e62 Merged PR 597: Pylint fixups
- include all python files in pylint checks
- improve version handling for pylint and update scripts
- make autopep8 available for vscode to use as a python formatter
- add more cspell words
- address some pylint warnings
- more pylint fixups
2022-08-30 19:58:49 +00:00
Brian Kroth 4ad1aa0495 Merged PR 572: Document experimental conda solver and enable Windows CI jobs
This is a follow up to !557 (Make conda work on Windows) and addresses some of the lingering comments from that PR.

- document the mamba slow solver workaround
- use the mamba solver if available in Makefile
- add windows jobs to the CI tasks as well
2022-08-18 04:43:22 +00:00
Brian Kroth fa768d8465 Merged PR 557: Make conda work on Windows
Related work items: #439
2022-08-12 16:43:26 +00:00
Brian Kroth a75fd4c633 Merged PR 561: Reorganize file layout to support separate whl outputs
Related work items: #444
2022-08-04 20:26:40 +00:00
Brian Kroth 79cc3e6762 Merged PR 380: Add conda env caching for build pipeline
- Add conda env caching for build pipeline speed ups.
  - Cache will use items from the last hour (within the same day), but only if the `environment.yml` and `setup.yml` file haven't changed.
- Adds testing for multiple Python versions.
  - Mostly as a proof of concept.  Right now just 3.8 and 3.9.  3.6 (the current default in Synapse) is broken and disabled.
  - We can disable this and just use the `DefaultPython` version again for now as well.
- Also enabled parallel builds as a part of this change.

Related work items: #322
2022-03-16 21:32:53 +00:00