Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
added benchmark to see if requests are handles sequential or in parallel
  • Loading branch information
proost committed Dec 16, 2016
1 parent 24f692b commit 8661dca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions planet/models/interpro.py
Expand Up @@ -7,6 +7,8 @@

from sqlalchemy.orm import joinedload

from utils.benchmark import benchmark

SQL_COLLATION = 'NOCASE' if db.engine.name == 'sqlite' else ''


Expand Down Expand Up @@ -98,19 +100,22 @@ def sequence_stats(sequence_ids):
return output

@property
@benchmark
def interpro_stats(self):
sequence_ids = [s.id for s in self.sequences.all()]

return Interpro.sequence_stats(sequence_ids)

@property
@benchmark
def go_stats(self):
from planet.models.go import GO
sequence_ids = [s.id for s in self.sequences.all()]

return GO.sequence_stats(sequence_ids)

@property
@benchmark
def family_stats(self):
from planet.models.gene_families import GeneFamily
sequence_ids = [s.id for s in self.sequences.all()]
Expand Down
2 changes: 1 addition & 1 deletion utils/benchmark.py
Expand Up @@ -17,7 +17,7 @@ def timed(*args, **kw):

args_str = (str(args)[:75] + ' ... ') if len(str(args)) > 75 else str(args)

print('%r (%r, %r) %2.3f sec' % (method.__name__, args_str, kw, te-ts))
print('%r: started: %2.3f, ran: %2.3f sec' % (method.__name__, ts, te-ts))
return result

return timed

0 comments on commit 8661dca

Please sign in to comment.