From 1334e7ea94d191f4108f6ae2e5de402462c61483 Mon Sep 17 00:00:00 2001 From: maffettone Date: Fri, 14 Feb 2025 09:52:27 -0500 Subject: [PATCH 1/9] fix: docs deps v4 --- .github/workflows/docs.yml | 88 +++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 02e4daa..f747b2e 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -10,50 +10,50 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.9] + python-version: [3.12] fail-fast: false steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - # These packages are installed in the base environment but may be older - # versions. Explicitly upgrade them because they often create - # installation problems if out of date. - python -m pip install --upgrade pip setuptools numpy - - pip install . - pip install -r requirements-dev.txt - pip install -r requirements-agents.txt - pip list - - - name: Build Docs - run: | - make -C docs/ html - - - name: Set env.REPOSITORY_NAME # just the repo, as opposed to org/repo - run: echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV - - - name: Upload built docs as artifacts - uses: actions/upload-artifact@v3 - with: - name: ${{ env.REPOSITORY_NAME }}-docs - path: docs/build/html - - - name: Deploy documentation to blueskyproject.io. - if: github.repository_owner == 'bluesky' && github.ref_name == 'main' - # We pin to the SHA, not the tag, for security reasons. - # https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions - uses: peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501 # v3.7.3 - with: - deploy_key: ${{ secrets.ACTIONS_DOCUMENTATION_DEPLOY_KEY }} - publish_branch: master - publish_dir: ./docs/build/html - external_repository: bluesky/bluesky.github.io - destination_dir: ${{ env.REPOSITORY_NAME }} # just the repo name, without the "bluesky/" - keep_files: true # Keep old files. - force_orphan: false # Keep git history. + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + # These packages are installed in the base environment but may be older + # versions. Explicitly upgrade them because they often create + # installation problems if out of date. + python -m pip install --upgrade pip setuptools numpy + + pip install . + pip install -r requirements-dev.txt + pip install -r requirements-agents.txt + pip list + + - name: Build Docs + run: | + make -C docs/ html + + - name: Set env.REPOSITORY_NAME # just the repo, as opposed to org/repo + run: echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV + + - name: Upload built docs as artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ env.REPOSITORY_NAME }}-docs + path: docs/build/html + + - name: Deploy documentation to blueskyproject.io. + if: github.repository_owner == 'bluesky' && github.ref_name == 'main' + # We pin to the SHA, not the tag, for security reasons. + # https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions + uses: peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501 # v3.7.3 + with: + deploy_key: ${{ secrets.ACTIONS_DOCUMENTATION_DEPLOY_KEY }} + publish_branch: master + publish_dir: ./docs/build/html + external_repository: bluesky/bluesky.github.io + destination_dir: ${{ env.REPOSITORY_NAME }} # just the repo name, without the "bluesky/" + keep_files: true # Keep old files. + force_orphan: false # Keep git history. From a11a13dcfe23ffbf8464f9e1cd7767157520a351 Mon Sep 17 00:00:00 2001 From: maffettone Date: Fri, 14 Feb 2025 09:55:44 -0500 Subject: [PATCH 2/9] fix: syntax in test --- bluesky_adaptive/tests/test_communication.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bluesky_adaptive/tests/test_communication.py b/bluesky_adaptive/tests/test_communication.py index de505c9..6ea1397 100644 --- a/bluesky_adaptive/tests/test_communication.py +++ b/bluesky_adaptive/tests/test_communication.py @@ -1,4 +1,4 @@ -""""Testing the communication patterns of Bluesky Adatptive Async Agents""" +"""Testing the communication patterns of Bluesky Adaptive Async Agents""" from typing import Sequence, Tuple, Union From 7fd94f125c40009d9f4f30f1f01fe3b9d7607242 Mon Sep 17 00:00:00 2001 From: maffettone Date: Fri, 14 Feb 2025 09:59:12 -0500 Subject: [PATCH 3/9] fix: yaml syntax in tests --- .github/workflows/tests.yml | 125 ++++++++++++++++++------------------ 1 file changed, 62 insertions(+), 63 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3862262..ec4fa40 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,85 +7,84 @@ on: - main workflow_dispatch: schedule: - - cron: '0 0 * * 0' # weekly + - cron: "0 0 * * 0" # weekly jobs: unit-tests: runs-on: ubuntu-latest strategy: - matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] - fail-fast: false + fail-fast: false steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - name: Download and build bluesky-pods - run: | - docker pull ghcr.io/bluesky/bluesky-pods-bluesky:main - docker tag ghcr.io/bluesky/bluesky-pods-bluesky:main bluesky:latest + - name: Download and build bluesky-pods + run: | + docker pull ghcr.io/bluesky/bluesky-pods-bluesky:main + docker tag ghcr.io/bluesky/bluesky-pods-bluesky:main bluesky:latest - - name: Start Bluesky containers - run: | - pushd bluesky_adaptive/tests/podman - docker-compose up -d - popd + - name: Start Bluesky containers + run: | + pushd bluesky_adaptive/tests/podman + docker-compose up -d + popd - - name: Log which containers are running - run: docker ps -a + - name: Log which containers are running + run: docker ps -a - - name: Check container status and fetch logs if any failed - run: | - failed_containers=() - while read -r container; do - status=$(docker inspect --format='{{.State.Status}}' "$container") - if [ "$status" != "running" ]; then - echo "::error ::Container $container has status $status" - failed_containers+=("$container") - fi - done < <(docker ps -aq) + - name: Check container status and fetch logs if any failed + run: | + failed_containers=() + while read -r container; do + status=$(docker inspect --format='{{.State.Status}}' "$container") + if [ "$status" != "running" ]; then + echo "::error ::Container $container has status $status" + failed_containers+=("$container") + fi + done < <(docker ps -aq) - for container in "${failed_containers[@]}"; do - echo "Logs for $container:" - docker logs "$container" - done - - if [ ${#failed_containers[@]} -ne 0 ]; then - echo "::error ::Some containers failed to start" - docker ps -a - exit 1 - fi + for container in "${failed_containers[@]}"; do + echo "Logs for $container:" + docker logs "$container" + done - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} + if [ ${#failed_containers[@]} -ne 0 ]; then + echo "::error ::Some containers failed to start" + docker ps -a + exit 1 + fi - - name: Install - shell: bash -l {0} - run: | - set -vxeuo pipefail - pip install --upgrade pip wheel - pip install . - pip install -r requirements-dev.txt - pip install -r requirements-agents.txt - mkdir -p /home/runner/.config/tiled/profiles - cp ./bluesky_adaptive/tests/podman/tiled_client_config.yml /home/runner/.config/tiled/profiles/tiled_client_config.yml - pip list + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} - - name: Reload Permissions for QServer (Ensures plans are available) - shell: bash -l {0} - run: | - set -vxeuo pipefail - qserver environment open - qserver permissions reload + - name: Install + shell: bash -l {0} + run: | + set -vxeuo pipefail + pip install --upgrade pip wheel + pip install . + pip install -r requirements-dev.txt + pip install -r requirements-agents.txt + mkdir -p /home/runner/.config/tiled/profiles + cp ./bluesky_adaptive/tests/podman/tiled_client_config.yml /home/runner/.config/tiled/profiles/tiled_client_config.yml + pip list - - name: Test with pytest - shell: bash -l {0} - run: | - set -vxeuo pipefail - coverage run -m pytest -v - coverage report + - name: Reload Permissions for QServer (Ensures plans are available) + shell: bash -l {0} + run: | + set -vxeuo pipefail + qserver environment open + qserver permissions reload + - name: Test with pytest + shell: bash -l {0} + run: | + set -vxeuo pipefail + coverage run -m pytest -v + coverage report From 1a6e9306ebae53f86469d897176df1208bde9a9d Mon Sep 17 00:00:00 2001 From: maffettone Date: Fri, 14 Feb 2025 10:06:29 -0500 Subject: [PATCH 4/9] maint: add json-rpc req --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index b19b8ef..cfeeba3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,3 +11,4 @@ numpy pydantic databroker @ git+https://github.com/bluesky/databroker.git@v2.0.0b41#egg=databroker +json-rpc From f54c7ed7892f340bf66f0a10b969496f98786afb Mon Sep 17 00:00:00 2001 From: maffettone Date: Fri, 14 Feb 2025 10:17:45 -0500 Subject: [PATCH 5/9] fix: tests to use containers --- .github/workflows/tests.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ec4fa40..76a105c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,6 +22,11 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Install Docker Compose + run: | + sudo apt-get update + sudo apt-get install -y docker-compose + - name: Download and build bluesky-pods run: | docker pull ghcr.io/bluesky/bluesky-pods-bluesky:main From e0edc927aa79d36f95cf7a21bccefcca7d7f2fc1 Mon Sep 17 00:00:00 2001 From: maffettone Date: Fri, 14 Feb 2025 10:28:55 -0500 Subject: [PATCH 6/9] maint: add tiled all for dev req --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index f04fb2b..9bfbd69 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -21,7 +21,7 @@ scipy pre-commit intake # This is required for the `tiled` package to make a Mongo client (some components from tiled[server]). -tiled[server] +tiled[all] humanize doct mongomock From 1489f3a7c09836948363bd011ef88c1bf0a56870 Mon Sep 17 00:00:00 2001 From: maffettone Date: Fri, 14 Feb 2025 10:39:02 -0500 Subject: [PATCH 7/9] fix: update databroker --- requirements-dev.txt | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 9bfbd69..f04fb2b 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -21,7 +21,7 @@ scipy pre-commit intake # This is required for the `tiled` package to make a Mongo client (some components from tiled[server]). -tiled[all] +tiled[server] humanize doct mongomock diff --git a/requirements.txt b/requirements.txt index cfeeba3..bf9eb9a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,5 +10,5 @@ tiled[client] numpy pydantic -databroker @ git+https://github.com/bluesky/databroker.git@v2.0.0b41#egg=databroker +databroker @ git+https://github.com/bluesky/databroker.git@v2.0.0b56#egg=databroker json-rpc From 9dd3cf0760b7a0dfff81309d02396f5b61c5e60d Mon Sep 17 00:00:00 2001 From: maffettone Date: Fri, 14 Feb 2025 10:47:00 -0500 Subject: [PATCH 8/9] add: bluesky tiled plugins --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index bf9eb9a..b1853bd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,4 +11,5 @@ numpy pydantic databroker @ git+https://github.com/bluesky/databroker.git@v2.0.0b56#egg=databroker +bluesky-tiled-plugins json-rpc From 0d6f9fa338059ddb3ab948e0f64102a61b28ab20 Mon Sep 17 00:00:00 2001 From: maffettone Date: Fri, 14 Feb 2025 11:08:22 -0500 Subject: [PATCH 9/9] fix: forward compat for botorch --- bluesky_adaptive/tests/test_botorch_agents.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bluesky_adaptive/tests/test_botorch_agents.py b/bluesky_adaptive/tests/test_botorch_agents.py index 93860de..dff4596 100644 --- a/bluesky_adaptive/tests/test_botorch_agents.py +++ b/bluesky_adaptive/tests/test_botorch_agents.py @@ -72,8 +72,10 @@ def test_remodel_from_report(catalog): partial_acq_function=lambda gp: UpperConfidenceBound(gp, beta=1.5), ) acqf, gp = new_agent.remodel_from_report(catalog[agent_uid]) - assert ( - gp.get_parameter("covar_module.base_kernel.raw_lengthscale") - == agent.surrogate_model.get_parameter("covar_module.base_kernel.raw_lengthscale") - ).all() + try: + param = gp.get_parameter("covar_module.base_kernel.raw_lengthscale") + assert (param == agent.surrogate_model.get_parameter("covar_module.base_kernel.raw_lengthscale")).all() + except AttributeError: + param = gp.get_parameter("covar_module.raw_lengthscale") + assert (param == agent.surrogate_model.get_parameter("covar_module.raw_lengthscale")).all() assert acqf.beta == 0.1