errant operations can cause client to lock up instead of throw exception
It seems that some errant operations on data returned from the Arrakis client can cause the library to lock up rather than raise an exception. For instance:
(igwn) servo:~/ligo/src/ngdd/arrakis-python [main*] 0$ ipython
Python 3.10.13 | packaged by conda-forge | (main, Oct 26 2023, 18:07:37) [GCC 12.3.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.26.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import arrakis
In [2]: for data in arrakis.stream(['L1:SUS-SRM_M2_WIT_P_DQ']):
...: print(data['foo'])
...:
This hangs indefinitely until I issue a Ctrl-C, at which point the appropriate exception is raised (at least in this ipython context):
In [2]: for data in arrakis.stream(['L1:SUS-SRM_M2_WIT_P_DQ']):
...: print(data['foo'])
...:
^CException ignored in: <generator object fetch_flights at 0x7feb1b955230>
Traceback (most recent call last):
File "/home/jrollins/ligo/src/ngdd/arrakis-python/arrakis/flight.py", line 157, in fetch_flights
with concurrent.futures.ThreadPoolExecutor() as executor:
File "/home/jrollins/.conda/envs/igwn/lib/python3.10/concurrent/futures/_base.py", line 649, in __exit__
self.shutdown(wait=True)
File "/home/jrollins/.conda/envs/igwn/lib/python3.10/concurrent/futures/thread.py", line 235, in shutdown
t.join()
File "/home/jrollins/.conda/envs/igwn/lib/python3.10/threading.py", line 1096, in join
self._wait_for_tstate_lock()
File "/home/jrollins/.conda/envs/igwn/lib/python3.10/threading.py", line 1116, in _wait_for_tstate_lock
if lock.acquire(block, timeout):
KeyboardInterrupt:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[2], line 2
1 for data in arrakis.stream(['L1:SUS-SRM_M2_WIT_P_DQ']):
----> 2 print(data['foo'])
File ~/ligo/src/ngdd/arrakis-python/arrakis/block.py:165, in SeriesBlock.__getitem__(self, channel)
163 def __getitem__(self, channel: str) -> Series:
164 return Series(
--> 165 self.time, self.data[channel], self.duration, self.channel(channel)
166 )
KeyError: 'foo'
In [3]:
Clearly something is locking up in the fetch_flight
ThreadPoolExecutor. Need to figure out how to break out of that when the application throws an exception.