Use elements from cache in ElementsWorker.run
Depends on !80 (merged)
The goal is to avoid the RetrieveElement
request. This should break some stuff (notably open_image
but that's good: it will be only used by worker with use_cache=True
). Do not aim for backward compatibility here.
The method list_elements
should take into account the cache presence, and give CachedElement
instances when there are any with initial=True
.
To clarify:
- if
use_cache=True
- AND there are some elements in DB with
initial=True
in the database - then return a list of those elements instead of the JSON list
process_element
would then use the CachedElement
instance. It is the responsibility of the high level worker to deal with the cached model
Regarding open_image
, it might be useful to simply add an open_image(*args, **kwargs)
proxy method towards image.open_image
(no IIIF manipulation, the correct url should be given by the backend)
Edited by Bastien Abadie