Posts

Showing posts with the label memory

How to share a :memory: database between different process in python using python sqlite3 package

How to share a :memory: database between different process in python using python sqlite3 package scenario is shown as below,i got many processes to do CPU-bound work and read only on the same database,i know cache and uri key words could be used for sqlite to share database cache between threads,but how about between processes?it's better to be available both for linux and windows, Thank you! def run(self): self.phyconn = apsw.Connection(self.fileName) self.memconn = apsw.Connection(":memory:") try:#backup.__exit__() just make sure copy if finished,not close backup,so with is good,memconn is still exist when out with self.memconn.backup("main", self.phyconn, "main") as backup: # call with 0 to get the total pages backup.step(0) total = backup.pagecount stepped = 0 one_percent = total if total < 100 else total // 100 last_percentage = 0 while step...

Biopython pairwise alignment results in segmentation fault when run in loop

Biopython pairwise alignment results in segmentation fault when run in loop I am trying to run pairwise global alignment method in biopython in loop for about 10000 pair of strings. Each string on an average is 20 characters long. Running the method for a single pair of sequences works fine. But running this in a loop, for as low as 4 pairs, results in segmentation fault. How can this be solved? biopython from Bio import pairwise2 def myTrial(source,targ): if source == targ: return [source,targ,source] alignments = pairwise2.align.globalmx(source, targ,1,-0.5) return alignments sour = ['najprzytulniejszy', 'sadystyczny', 'wyrzucić', 'świat'] targ = ['najprzytulniejszym', 'sadystycznemu', 'wyrzucisz', 'świat'] for i in range(4): a = myTrial(sour[i],targ[i]) 1 Answer 1 The segmentation fault isn't happening...