From eae66f4d90c7136881fc9ef86743a613f9af0d9c Mon Sep 17 00:00:00 2001
From: Yves Noirjean <yves.noirjean@id.ethz.ch>
Date: Wed, 27 Jun 2018 15:15:55 +0200
Subject: [PATCH] SSDM-6731: pybis - marking task as done when failing to
 download file so the process does not get stuck

---
 pybis/src/python/pybis/dataset.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/pybis/src/python/pybis/dataset.py b/pybis/src/python/pybis/dataset.py
index d2178be94b3..78750bf7ec3 100644
--- a/pybis/src/python/pybis/dataset.py
+++ b/pybis/src/python/pybis/dataset.py
@@ -514,6 +514,7 @@ class DataSetDownloadQueue():
             # request the file in streaming mode
             r = requests.get(url, stream=True, verify=verify_certificates)
             if r.ok == False:
+                self.download_queue.task_done()
                 raise ValueError("Could not download from {}: HTTP {}. Reason: {}".format(url, r.status_code, r.reason))
 
             with open(filename_dest, write_mode) as f:
@@ -525,5 +526,6 @@ class DataSetDownloadQueue():
                 if self.collect_files_with_wrong_length:
                     self.files_with_wrong_length.append(filename)
                 else:
+                    self.download_queue.task_done()
                     raise ValueError("File has the wrong length: {}".format(filename_dest))
             self.download_queue.task_done()
-- 
GitLab