Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS test fixups and CI pipelines #876

Merged
merged 35 commits into from
Nov 5, 2024
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
9711511
mypy updates
bpkroth Oct 21, 2024
e716db9
parallel runner disambiguation
bpkroth Oct 21, 2024
aa16e2c
Merge branch 'main' into macos-ci-and-fixups
bpkroth Oct 31, 2024
f89eaba
Basic MacOS CI checks
bpkroth Oct 31, 2024
6829634
Add a run script for Windows
bpkroth Oct 31, 2024
ab7c4e6
Add basic devcontainer build/run checks
bpkroth Oct 31, 2024
57813dc
fixups
bpkroth Oct 31, 2024
3a63e6a
test
bpkroth Oct 31, 2024
d4b378f
check docker
bpkroth Oct 31, 2024
53eb0fc
refactor jobs
bpkroth Nov 1, 2024
bcf6dfd
more info
bpkroth Nov 1, 2024
a733564
debug
bpkroth Nov 1, 2024
60f7aea
debug
bpkroth Nov 1, 2024
e4d3cab
disable
bpkroth Nov 1, 2024
5512c15
tweaks
bpkroth Nov 1, 2024
4060880
whitespace
bpkroth Nov 1, 2024
48788a8
try again
bpkroth Nov 1, 2024
a557cd4
fixupo
bpkroth Nov 1, 2024
4e53cb4
fixups
bpkroth Nov 1, 2024
1ca1be4
more debugging
bpkroth Nov 1, 2024
22f478c
Disable the devcontainer rules for now
bpkroth Nov 1, 2024
e668139
debugging
bpkroth Nov 4, 2024
92dba3b
fixups
bpkroth Nov 4, 2024
9b77d06
more debugging
bpkroth Nov 4, 2024
17aed27
Fixups for odd rebuild behavior in MacOS
bpkroth Nov 4, 2024
383144f
Revert "more debugging"
bpkroth Nov 4, 2024
0adc4a4
Revert "debugging"
bpkroth Nov 4, 2024
a3a1f72
fixup
bpkroth Nov 4, 2024
d15e18f
more portability things
bpkroth Nov 4, 2024
5094813
format
bpkroth Nov 4, 2024
a9f1a6b
naming tweaks
bpkroth Nov 4, 2024
dcc04fc
Merge branch 'main' into macos-ci-and-fixups
bpkroth Nov 4, 2024
cf83135
Add MacOS status badge to the README
bpkroth Nov 4, 2024
1326635
naming
bpkroth Nov 5, 2024
568654f
naming
bpkroth Nov 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "debugging"
This reverts commit e668139.
bpkroth committed Nov 4, 2024
commit 0adc4a4eda1a3c9297701ff9280573008e0aaa6e
20 changes: 0 additions & 20 deletions mlos_bench/mlos_bench/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -5,8 +5,6 @@
"""Common fixtures for mock TunableGroups and Environment objects."""

import os
from logging import warning
from time import time_ns
from typing import Any, Generator, List, Union

import sys
@@ -158,16 +156,11 @@ def locked_docker_services(
"""A locked version of the docker_services fixture to implement xdist single
instance locking.
"""
worker_id = os.environ.get("PYTEST_XDIST_WORKER")
# pylint: disable=too-many-arguments,too-many-positional-arguments
# Mark the services as in use with the reader lock.
warning(f"{time_ns()} {worker_id}: Acquiring read lock on {docker_services_lock.path}")
docker_services_lock.acquire_read_lock()
warning(f"{time_ns()} {worker_id}: Acquired read lock on {docker_services_lock.path}")
# Acquire the setup lock to prevent multiple setup operations at once.
warning(f"{time_ns()} {worker_id}: Acquiring lock on {docker_setup_teardown_lock.path}")
docker_setup_teardown_lock.acquire()
warning(f"{time_ns()} {worker_id}: Acquired lock on {docker_setup_teardown_lock.path}")
# This "with get_docker_services(...)"" pattern is in the default fixture.
# We call it instead of docker_services() to avoid pytest complaints about
# calling fixtures directly.
@@ -180,35 +173,22 @@ def locked_docker_services(
) as docker_services:
# Release the setup/tear down lock in order to let the setup operation
# continue for other workers (should be a no-op at this point).
warning(f"{time_ns()} {worker_id}: Releasing {docker_setup_teardown_lock.path}")
docker_setup_teardown_lock.release()
warning(f"{time_ns()} {worker_id}: Released {docker_setup_teardown_lock.path}")
# Yield the services so that tests within this worker can use them.
warning(f"{time_ns()} {worker_id}: Yielding services")
yield docker_services
# Now tests that use those services get to run on this worker...
# Once the tests are done, release the read lock that marks the services as in use.
warning(f"{time_ns()} {worker_id}: Releasing read lock on {docker_services_lock.path}")
docker_services_lock.release_read_lock()
warning(f"{time_ns()} {worker_id}: Released read lock on {docker_services_lock.path}")
# Now as we prepare to execute the cleanup code on context exit we need
# to acquire the setup/teardown lock again.
# First we attempt to get the write lock so that we wait for other
# readers to finish and guard against a lock inversion possibility.
warning(f"{time_ns()} {worker_id}: Acquiring write lock on {docker_services_lock.path}")
docker_services_lock.acquire_write_lock()
warning(f"{time_ns()} {worker_id}: Acquired write lock on {docker_services_lock.path}")
# Next, acquire the setup/teardown lock
# First one here is the one to do actual work, everyone else is basically a no-op.
# Upon context exit, we should execute the docker_cleanup code.
# And try to get the setup/tear down lock again.
warning(f"{time_ns()} {worker_id}: Acquiring {docker_setup_teardown_lock.path}")
docker_setup_teardown_lock.acquire()
warning(f"{time_ns()} {worker_id}: Acquired {docker_setup_teardown_lock.path}")
# Finally, after the docker_cleanup code has finished, remove both locks.
warning(f"{time_ns()} {worker_id}: Releasing {docker_setup_teardown_lock.path}")
docker_setup_teardown_lock.release()
warning(f"{time_ns()} {worker_id}: Released {docker_setup_teardown_lock.path}")
warning(f"{time_ns()} {worker_id}: Releasing write lock on {docker_services_lock.path}")
docker_services_lock.release_write_lock()
warning(f"{time_ns()} {worker_id}: Released write lock on {docker_services_lock.path}")
5 changes: 0 additions & 5 deletions mlos_bench/mlos_bench/tests/services/remote/ssh/__init__.py
Original file line number Diff line number Diff line change
@@ -5,12 +5,9 @@
"""Common data classes for the SSH service tests."""

from dataclasses import dataclass
from logging import warning
from subprocess import run
from typing import Optional

import os

from pytest_docker.plugin import Services as DockerServices

from mlos_bench.tests import check_socket
@@ -78,8 +75,6 @@ def to_connect_params(self, uncached: bool = False) -> dict:

def wait_docker_service_socket(docker_services: DockerServices, hostname: str, port: int) -> None:
"""Wait until a docker service is ready."""
worker_id = os.environ.get("PYTEST_XDIST_WORKER")
warning(f"{worker_id} Waiting for {hostname}:{port} to be ready.")
docker_services.wait_until_responsive(
check=lambda: check_socket(hostname, port),
timeout=30.0,
8 changes: 2 additions & 6 deletions mlos_bench/mlos_bench/tests/services/remote/ssh/fixtures.py
Original file line number Diff line number Diff line change
@@ -71,9 +71,7 @@ def ssh_test_server(
id_rsa_path=id_rsa_file.name,
)
wait_docker_service_socket(
locked_docker_services,
ssh_test_server_info.hostname,
ssh_test_server_info.get_port(),
locked_docker_services, ssh_test_server_info.hostname, ssh_test_server_info.get_port()
)
id_rsa_src = f"/{ssh_test_server_info.username}/.ssh/id_rsa"
docker_cp_cmd = (
@@ -118,9 +116,7 @@ def alt_test_server(
id_rsa_path=ssh_test_server.id_rsa_path,
)
wait_docker_service_socket(
locked_docker_services,
alt_test_server_info.hostname,
alt_test_server_info.get_port(),
locked_docker_services, alt_test_server_info.hostname, alt_test_server_info.get_port()
)
return alt_test_server_info

Original file line number Diff line number Diff line change
@@ -141,7 +141,6 @@ def test_ssh_service_remote_exec(

# Make sure the cache is cleaned up on context exit.
assert len(SshHostService._EVENT_LOOP_THREAD_SSH_CLIENT_CACHE) == 0
assert False, "Testing"


def check_ssh_service_reboot(
@@ -250,4 +249,3 @@ def test_ssh_service_reboot(
ssh_host_service,
graceful=False,
)
assert False, "Testing"