Skip to content

Commit

Permalink
For #280: the biggest, by far, problem in mikado serialise for the …
Browse files Browse the repository at this point in the history
…ORFs was that the reading process waas **blocking**, due to using a simple queue with a bare put instead of put_nowait. This single change makes the code finally parallel and provides therefore a massive speed-up.
  • Loading branch information
lucventurini committed Mar 2, 2020
1 parent 262abc5 commit 4b88696
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Mikado/serializers/orf.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def __serialize_single_thread(self):
def __serialize_multiple_threads(self):
""""""

send_queue = mp.SimpleQueue()
send_queue = mp.Queue(-1)
return_queue = mp.SimpleQueue()
self.logging_queue = mp.Queue(-1)
self.logger_queue_handler = logging_handlers.QueueHandler(self.logging_queue)
Expand Down Expand Up @@ -401,11 +401,12 @@ def line_parser_func(handle, fai, send_queue):
send_queue.put((num, line, None))
else:
_f = line.split("\t")
if _f[0] not in fai.references:
if _f[0] not in fai:
seq = None
else:
seq = zlib.compress(fai[line.split("\t")[0]].encode(), 1)
send_queue.put((num, line, seq))
send_queue.put_nowait((num, line, seq))

send_queue.put("EXIT")

line_parser = mp.Process(target=line_parser_func,
Expand Down

0 comments on commit 4b88696

Please sign in to comment.