Spaces:
Running
Running
ksvmuralidhar
commited on
Commit
•
d3bed32
1
Parent(s):
ce53872
Update db_operations/db_operations.py
Browse files
db_operations/db_operations.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
import pymongo
|
2 |
import os
|
3 |
import pandas as pd
|
4 |
-
import time
|
5 |
import logging
|
6 |
|
7 |
|
@@ -33,11 +32,12 @@ class DBOperations:
|
|
33 |
docs = []
|
34 |
maxtries = 5
|
35 |
ntry = 0
|
36 |
-
|
|
|
37 |
for doc in coll.find():
|
38 |
docs.append(doc)
|
39 |
-
|
40 |
-
|
41 |
|
42 |
rss_df = pd.DataFrame(docs)
|
43 |
except Exception as insert_err:
|
|
|
1 |
import pymongo
|
2 |
import os
|
3 |
import pandas as pd
|
|
|
4 |
import logging
|
5 |
|
6 |
|
|
|
32 |
docs = []
|
33 |
maxtries = 5
|
34 |
ntry = 0
|
35 |
+
|
36 |
+
while (len(docs) == 0) and (ntry < maxtries):
|
37 |
for doc in coll.find():
|
38 |
docs.append(doc)
|
39 |
+
ntry += 1
|
40 |
+
logging.info(f"DB Read try: {ntry}")
|
41 |
|
42 |
rss_df = pd.DataFrame(docs)
|
43 |
except Exception as insert_err:
|