meraki-analytics/cassiopeia-datastores

Can't expire KV store: "TypeError: 'set' object does not support indexing"

Opened this issue · 0 comments

I'm trying to implement a disk KV store into my already existing and working pipeline with an SQLStore, to speed up response times.
The Readme states to use settings.pipeline.expire to manually expire the KV, as it's not expiring automatically.

I'm not 100% certain what this is supposed to mean, as this method does not exist, but I assumed cass.configuration.settings.expire_sinks() is meant. As I only want to expire the KV store, I tried to manually expire it:

""" Cass has been initialized with both datastores and some more stuff, like expirations """

    for sink in cass.configuration.settings.pipeline._sinks:
        if isinstance(sink, cassiopeia_diskstore.SimpleKVDiskStore):
            print("Expiring cass KV sink.")
            sink.expire()

But I get an error:

Traceback (most recent call last):
  File "C:/app/zero_usage_tester.py", line 19, in <module>
    expire_disk_store()
  File "C:/app/zero_usage_tester.py", line 15, in expire_disk_store
    sink.expire()
  File "c:\venv\src\cassiopeia-diskstore\cassiopeia-diskstore\cassiopeia_diskstore\__init__.py", line 63, in expire
    store = sinks[0]._store
TypeError: 'set' object does not support indexing

The error seems to be here:

sinks = {sink for many_sinks in self._sinks.values() for sink in many_sinks}

Am I doing something wrong? What would be the best practice?
and/or
Is my assumption of this bug correct?