You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changed code regarding multiprocessing Queue in the return from XMFA_obj.run in find_snps. It is now "streamed" instead of processed once the child finished. (#40)
Co-authored-by: Jacob Lewerentz <jaclew@# Managed by FOI IT-Enheten. To make changes contact Servicedesk>
'''Align sequences to references and return SNPs'''
248
+
# execute snp calling
248
249
XMFA_obj.run(xmfa_file)
249
-
results.put(XMFA_obj.get_snps())
250
-
export_results.put(XMFA_obj.get_snp_info())
251
-
called_snps.put(XMFA_obj.get_called_snps())
252
-
returnresults
250
+
#/
251
+
# stream output into Queues (if the complete job output is put in then the queue gets filled when having "large" outputs. It has to be streamed to the queue so that the queue can simultanously be cleared)
# check if we have computed for X amount of time, then break and assume something is wrong
321
+
max_time_seconds=5*60# 5*60 => 5 minutes
322
+
toc=time()
323
+
time_spent=toc-tic
324
+
iftime_spent>max_time_seconds:
325
+
logger.warning("Maximum time spent reached to capture queue output. This is not expected to happen and might mean that your output data is corrupted.")
326
+
break
327
+
#/
328
+
##/
329
+
## Wait until processes terminated (their output should already have been processed in the queue's)
268
330
forjobinjobs:
269
331
job.join()
270
-
forjinjobs:
271
-
## Merge SNP result dictionaries
272
-
SNPS=dict(**SNPS, **result_queue.get())
273
-
### join SNP info files
274
-
SNP_info+=export_queue.get()
275
-
called_snps+=called_queue.get()
332
+
##/
276
333
returnSNPS,SNP_info,called_snps
277
334
278
335
defread_result_dir(self):
@@ -324,7 +381,7 @@ def run(self,database):
324
381
verbose=self.verbose) ## Create XMFA object and connect to database
325
382
'''Walk through the list of queries supplied'''
326
383
ifnotself.skip_mauve: print("Run {n} alignments to references using progressiveMauve".format(n=len(self.query)))
327
-
forqinself.query:## For each query file_path
384
+
forqinself.query:## For each query file_path
328
385
try:
329
386
self.query_name=os.path.basename(q).rsplit(".",1)[0] ## get name of file and remove ending
0 commit comments