Skip to content

Instantly share code, notes, and snippets.

@flavioamieiro
Created October 22, 2015 15:17
Show Gist options
  • Save flavioamieiro/a04d1f0e4b97a5a70480 to your computer and use it in GitHub Desktop.
Save flavioamieiro/a04d1f0e4b97a5a70480 to your computer and use it in GitHub Desktop.
Wrote profile results to benchmarking.py.lprof
Timer unit: 1e-06 s
Total time: 3.2938 s
File: pypln/backend/celery_task.py
Function: run at line 45
Line # Hits Time Per Hit % Time Line Contents
==============================================================
45 @profile
46 def run(self, document_id):
47 """
48 This method is called by Celery, and should not be overridden.
49 It will call the `process` method with a dictionary containing all the
50 document information and will update de database with results.
51 """
52 100 340 3.4 0.0 document = MongoDictAdapter(doc_id=document_id,
53 100 245 2.5 0.0 host=config.MONGODB_CONFIG['host'],
54 100 130 1.3 0.0 port=config.MONGODB_CONFIG['port'],
55 100 351966 3519.7 10.7 database=config.MONGODB_CONFIG['database'])
56 # Create a dictionary out of our document. We could simply pass
57 # it on to the process method, but for now we won't let the user
58 # manipulate the MongoDict directly.
59 100 1507720 15077.2 45.8 dic = {k: v for k, v in document.iteritems()}
60 100 1140490 11404.9 34.6 result = self.process(dic)
61 100 292692 2926.9 8.9 document.update(result)
62 100 217 2.2 0.0 return document_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment