argosopentech / argos-translate

Open-source offline translation library written in Python
https://www.argosopentech.com
MIT License
3.84k stars 279 forks source link

argospm needs crash recovery for failed downloads #256

Open bruceleerabbit opened 2 years ago

bruceleerabbit commented 2 years ago

This is essentially a mirror of this bug:

https://github.com/argosopentech/argos-translate-gui/issues/3

Since the GUI apparently doesn’t call argospm, argospm needs its own crash recovery mechanism. This is a feature request for crash recovery. Note that a crash that creates need for a recovery mechanism is documented here:

https://github.com/argosopentech/argos-translate/issues/258

In an effort to find a workaround, I had a look in ~/.local/cache/argos-translate/downloads and in /tmp/ after a crash, and there were no partial files. So there seems to be no way to manually recover because it’s cleaning up the partial files.

These crashes are costly for people on measured rate Internet connections.

(edit) A possible workaround might be to manually grab the lang pair from:

https://github.com/argosopentech/LibreTranslate-Models

then the *.argosmodel file can apparently just be unzipped in ~/share/argos-translate/packages.

To grab the file, my 1st thought is that there is some advanced git wizardry that can git clone without cloning the whole repo (a shallow partial clone). But apparently git does not feature crash recovery of partial blobs. So wget -c is perhaps the best way to grab models.

PJ-Finlay commented 2 years ago

We should have better exception handling when a download fails.