Skip to content

New CachedDataset and CachedDatasetElement models in cache

New training worker will need to know the set of an element without doing an actual request if possible.

We need two models:


from peewee import SQL
class CachedDataset(Model):
    id = CharField(primary_key=True)
    name = CharField()
    state = CharField(constraints=[SQL("DEFAULT 'open'")])
    sets = TextField()


class CachedDatasetElement(Model):
    id = CharField(primary_key=True)
    element = ForeignKeyField(column_name="element_id", field="id", model=CachedElement)
    dataset = ForeignKeyField(column_name="dataset_id", field="id", model=CachedDataset)
    set_name = CharField()

    class Meta:
        table_name = "dataset_element"

We'll bump the Cache version as well.

Only introduce the models, then we'll work on the helpers.

Edited by Yoann Schneider