Skip to content

Commit 5f8a95c

Browse files
authored
Catching pause state (#413)
* Catching pause state This tweak to readfish will prevent readfish from stopping when a user pauses a flowcell for some reason. As a consequence it is now safe to pause a flowcell whilst readfish is running without cuasing readfish to stop. This update will not affect older versions of minknow which did not explicitly declare a pause state. * Addressing failed test A fix to force tests to use integers.
1 parent c6e52c7 commit 5f8a95c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/readfish/_read_until_client.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,17 @@
1414
from readfish._loggers import setup_logger
1515
from grpc import RpcError
1616

17-
# Check against these states to determine if Minknow is under the impression
18-
# The run has fully begun and readfish can be started
17+
# Check against these states to determine if MinKNOW still considers the run
18+
# active enough for readfish to remain connected.
1919
ACCEPTABLE_ACQUISITION_STATES = {
2020
AcquisitionState.ACQUISITION_RUNNING,
2121
AcquisitionState.ACQUISITION_STARTING,
2222
}
23+
# Some MinKNOW versions expose explicit pause states. Treat them as non-terminal
24+
# so readfish waits for sequencing to resume instead of disconnecting.
25+
for _state_name in ("ACQUISITION_PAUSING", "ACQUISITION_PAUSED"):
26+
if hasattr(AcquisitionState, _state_name):
27+
ACCEPTABLE_ACQUISITION_STATES.add(getattr(AcquisitionState, _state_name))
2328
# Any but these two states suggest the run has stopped
2429
ACCEPTABLE_PROTOCOL_STATES = {
2530
protocol_service.PROTOCOL_RUNNING,

src/readfish/_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,9 @@ def get_flowcell_array(flowcell_size: int) -> npt.ArrayLike:
242242
Traceback (most recent call last):
243243
...
244244
ValueError: flowcell_size is not recognised
245-
>>> get_flowcell_array(126)[9][-1]
245+
>>> int(get_flowcell_array(126)[9][-1])
246246
0
247-
>>> get_flowcell_array(512)[15][-1]
247+
>>> int(get_flowcell_array(512)[15][-1])
248248
1
249249
250250
"""

0 commit comments

Comments
 (0)