It is possible for the Model Downloader to hang if both of the workers encounter exceptions and leave their tasks in the queue.
In the DownloadWorker.run() method if self.downloader.download() raises an Exception, the worker will stop without marking the queued task as done. If that happens to both worker threads the process will hang.
A possible solution would be to catch the exceptions:
def run(self):
while not self.downloader.download_queue.empty():
try:
module = self.downloader.download_queue.get(timeout=0.01)
except Empty:
pass
else:
try:
self.downloader.download(module)
except Exception as e:
logger.exception(e)
self.downloader.download_queue.task_done()
logger.debug('Thread {} exits'.format(current_thread().name))
which will at least let the process finish without hanging.
It is possible for the Model Downloader to hang if both of the workers encounter exceptions and leave their tasks in the queue.
In the DownloadWorker.run() method if self.downloader.download() raises an Exception, the worker will stop without marking the queued task as done. If that happens to both worker threads the process will hang.
A possible solution would be to catch the exceptions:
which will at least let the process finish without hanging.