core
core copied to clipboard
processor.resolve_resource: support ad-hoc downloading
As an idea to make sharing knowledge about (combinations of) external resources easier: It would be great if processor.resolve_resource would not only search the locally installed resources, but also try to download if the query is a URL (if it is not locally available already) and automatically register the result. That way one could formulate recipes solely based on URLs and never bother with the deployment details.
I think we disabled that on-demand-downloading feature explicitly in https://github.com/OCR-D/core/pull/663. The discussion there focussed on the --location pwd functionality though.
Implementing this is not too difficult, but it increases the risk of runtime problems, because network accessibility of the resources is then an additional source for errors at runtime. I think that was the reasoning for dropping on-demand-downloading support but I am open to reintroducing it if there's demand for that.
Too bad we did not discuss the actual change originally.
You are right in that making Processor.resolve_resource possibly dependent on networking could introduce unproducable effects during processing (e.g. in CI environments). But on the other hand, it's up to the user – if you don't use file resources with URLs, then nothing should change. If I share a recipe/preset/workflow which includes a URL resource, then I am aware of that danger (but for the sake of simplicity might prefer that over a sequence of installation and processing instructions). Also, if we implement it properly, it should not access the network anymore as soon as the resource has been registered (i.e. after the first download). So I could say: try this recipe interactively on your target to also deploy it.