-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(api): Monitor PAPI commands, not PE commands (#13724)
* Remove broker from ProtocolEngine. This partially reverts commit 24eb3c1 ("fix(api): New protocols print a JSON "run log" from opentrons_execute and opentrons.execute.execute() (#13629)"). * Add broker to ProtocolRunner. * Update execute.py. * Update test_execute.py. * Further deduplicate test_execute.py.
- Loading branch information
1 parent
894979f
commit 83628f3
Showing
11 changed files
with
55 additions
and
353 deletions.
There are no files selected for viewing
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
12 changes: 0 additions & 12 deletions
12
api/src/opentrons/protocol_engine/state/change_notifier.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,19 @@ | ||
"""Simple state change notification interface.""" | ||
import asyncio | ||
|
||
from opentrons.util.broker import Broker, ReadOnlyBroker | ||
|
||
|
||
class ChangeNotifier: | ||
"""An interface tto emit or subscribe to state change notifications.""" | ||
|
||
def __init__(self) -> None: | ||
"""Initialize the ChangeNotifier with an internal Event.""" | ||
self._event = asyncio.Event() | ||
self._broker = Broker[None]() | ||
|
||
def notify(self) -> None: | ||
"""Notify all `wait`'ers that the state has changed.""" | ||
self._event.set() | ||
self._broker.publish(None) | ||
|
||
async def wait(self) -> None: | ||
"""Wait until the next state change notification.""" | ||
self._event.clear() | ||
await self._event.wait() | ||
|
||
@property | ||
def broker(self) -> ReadOnlyBroker[None]: | ||
"""Return a broker that you can use to get notified of all changes. | ||
This is an alternative interface to `wait()`. | ||
""" | ||
return self._broker |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.