Quellcode durchsuchen

Add print statement informning about how long it takes to convert mongo result into dataframe

ogert vor 5 Jahren
Ursprung
Commit
fff0eae0e0
2 geänderte Dateien mit 5 neuen und 1 gelöschten Zeilen
  1. 1 1
      Pipfile.lock
  2. 4 0
      cdplib/db_handlers/MongodbHandler.py

+ 1 - 1
Pipfile.lock

@@ -19,7 +19,7 @@
         "cdplib": {
             "editable": true,
             "git": "https://readonly:readonly@intra.acdp.at/gogs/tanja/cdplib.git",
-            "ref": "430d190a8742f3f7145da6b9e1d9b05d218a5783"
+            "ref": "da868ad2fe85fa71106af11bc20b8e3e7c18e792"
         },
         "jsonref": {
             "hashes": [

+ 4 - 0
cdplib/db_handlers/MongodbHandler.py

@@ -289,6 +289,8 @@ class MongodbHandler:
 
     def convert_mongo_data_into_dataframe(self, data, index: str = None, collection_name: str = None) -> pd.DataFrame():
 
+        start_time = time.time()
+        self._log.info('Converting returned mongo data into a DataFrame')
         data = list(data)
         try:
             if len(data)> 0:
@@ -299,6 +301,8 @@ class MongodbHandler:
                 df = pd.DataFrame(data)
                 if index is not None:
                     df.set_index(index, inplace=True)
+
+                self._log.info(('DataFrame conversion is done, took {} seconds').format(time.time()-start_time))
                 return df
             else:
                 self._log.warning(('No data for the query was found').format())