Cache corpus worker versions using a DB table
Replaces #771 (closed).
We'll build a cache for worker versions used in corpus, using a new database model (a M2M between corpus and worker version) named CorpusWorkerVersion
.
It should only have the 2 FK towards Corpus & Worker Version.
A Django management command named cache_worker_versions
will list all worker versions used by ML results on every corpus and update that table.
This code should also be used in the database migration to initially fill the table.
The StartProcess
API endpoint should make sure the worker versions used in that new process are also present in the table for the current corpus.
Finally, ListCorpusWorkerVersions
should only use that new table to list available worker versions for a corpus.
Refs https://gitlab.com/arkindex/requests/-/issues/359 and https://gitlab.com/arkindex/requests/-/issues/359