Repository navigation
Launch Open Ephys GUI and wait for its API, locally or remotely - #294
Merged
Merged
Conversation
- OpenEphysApp.launch(executor=...) is an async context manager that starts the GUI, waits until its HTTP API responds, yields the client, and quits the GUI on exit. It fails if the GUI exits before its API is up or the API does not respond within the timeout, and a caller error takes precedence over a GUI failure - With an executor that runs on another machine (it has a `host`, like RemoteRepository), a loopback address is replaced by that host - Add a `headless` setting (--headless) - client.quit() uses /api/quit (GUI v1.1+, works headless), falling back to the /api/window command of older GUIs; /api/window returns 404 on v1.1.0 - Fix the default executable path to ./.open-ephys/open-ephys.exe, as laid out by Aind.Physiology.OpenEphys - Add Aind.Physiology.OpenEphys as a test submodule; tests against the real GUI run headless and are skipped unless the GUI was downloaded - Remove an unused Open Ephys test fixture that could not construct the app
# Conflicts: # tests/xml-rpc/test_remote.py
# Conflicts: # tests/xml-rpc/test_remote.py
- launch() starts the GUI in the background, waits for its API and returns the client; it closes the GUI itself if launching fails - start() / stop() start and stop recording (or only acquisition) - close() quits the GUI, waits for it to exit and returns its result - Removes the @asynccontextmanager with an AsyncIterator return type, which Pylance reports as deprecated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #292 (uses
run_async(executor=...)). Lets an experiment start the Open Ephys GUI, wait until it's ready, drive it, and shut it down, on this machine or on another rig:Changes
launch()/start()/stop()/close()(no context manager):launch(executor=None, timeout=180, ...)runs the GUI in the background, polls/api/statusuntil it responds, and returns the client. If launching fails (the GUI exits first, ortimeoutpasses), it closes the GUI itself before raisingCommandError/RuntimeError/TimeoutError.start(record=True)/stop()start and stop recording (or only acquisition).close()quits the GUI, waits for it to exit and returns its result (raisingCommandErroron a non-zero exit). Calling it when nothing is launched does nothing.host(RemoteRepository) and an address oflocalhost/127.0.0.1/::1, the client is pointed at the remote host. An explicit address is kept.headlesssetting: adds--headless.client.quit()fix. It now usesPUT /api/quit, falling back to the old/api/windowcommand only on a 404. On GUI v1.1.0,/api/windowreturns 404, so the oldquit()didn't work on the versionAind.Physiology.OpenEphysships./api/quitalso works headless../.open-ephys/open-ephys.exe(hyphens), matchingAind.Physiology.OpenEphys. The old./.open_ephys/open_ephys.exenever matched.tests/assets/Aind.Physiology.OpenEphys, pinned to09c8579(GUI v1.1.0).OpenEphysApp.Tests
fake_open_ephys_guifixture): a small HTTP script covering readiness, early exit, timeout, caller errors and quit. Also run through a realRemoteRepository.RemoteRepository: launch, status, processors, start/stop acquisition, quit with exit code 0. About 4 s each.example.xmlcontains Neuropix-PXI, which blocks headless startup indefinitely with no hardware attached.tests/assets/Aind.Physiology.OpenEphys/.open-ephys/setup.ps1 -NoLaunch), so CI (no submodules) skips them.Review notes
example.xml, startup took 40–110 s on a machine without hardware, while hardware plugins searched for devices. Hence the 180 s default timeout.launchlogs a warning that it may still be running.submodules: trueplus the setup step on a Windows runner.