Skip to content

Commit

Permalink
fallback_pattern as parameter of ThreadedDownloaderBufferOnly
Browse files Browse the repository at this point in the history
  • Loading branch information
svebk committed Feb 6, 2020
1 parent 0d5adf0 commit a7cb2ea
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cufacesearch/cufacesearch/updater/extraction_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class ThreadedDownloaderBufferOnly(threading.Thread):
Multi-threaded download images from the web or load from disk.
"""

def __init__(self, q_in, q_out, url_input=True):
def __init__(self, q_in, q_out, url_input=True, fbptrn=None):
"""ThreadedDownloaderBufferOnly constructor
:param q_in: input queue
Expand All @@ -69,7 +69,7 @@ def __init__(self, q_in, q_out, url_input=True):
self.url_input = url_input
# If you have another way of getting the images based on SHA1
# TODO: This could be a parameter... Should be passed down from ExtractionProcessor
self.fallback_pattern = None
self.fallback_pattern = fbptrn
# self.fallback_pattern = "https://www.fallback.com/image/{}.jpeg"

def run(self):
Expand Down Expand Up @@ -142,6 +142,7 @@ def __init__(self, global_conf, prefix=DEFAULT_EXTR_PROC_PREFIX):
self.ingestion_input = self.get_param("update_ingestion_type", default="hbase")
self.push_back = bool(self.get_param("push_back", default=False))
self.check_missing = bool(self.get_param("check_missing", default=False))
self.fallback_pattern = bool(self.get_param("fallback_pattern", default=None))
file_input = self.get_param("file_input")
print("[{}.ExtractionProcessor: log] file_input: {}".format(self.pp, file_input))
if file_input:
Expand Down Expand Up @@ -621,7 +622,8 @@ def process_batch(self):
for i in range(min(self.nb_threads, nb_imgs_dl)):
# should read (url, obj_pos) from self.q_in
# and push (url, obj_pos, buffer, img_info, start_process, end_process) to self.q_out
thread = ThreadedDownloaderBufferOnly(q_in_dl, q_out_dl, url_input=self.url_input)
thread = ThreadedDownloaderBufferOnly(q_in_dl, q_out_dl, url_input=self.url_input,
fbptrn=self.fallback_pattern)
thread.start()
threads_dl.append(thread)

Expand Down

0 comments on commit a7cb2ea

Please sign in to comment.