ts_observatory_control tries to set the result or exception of several asyncio.Futures, without first testing if they are done. That results in very confusing error messages if the Future is already done.
Update the code to check first, e.g. change:
Also BaseTCS.ready_to_take_data is rather complicated in the way it handles tasks:
- It is a sync method that returns a Task or Future, but there does not appear to be any need for this. Make it a normal async method instead.
- It calls private implementation _ready_to_take_data and expects it to set a Future, but there's no need for that future (it basically duplicates an already existing task). It can just be a coroutine that returns when done or raises on error.