Created
March 21, 2017 21:24
-
-
Save CJ-Wright/9eba5adcee010bc8f6ea083a2df8b268 to your computer and use it in GitHub Desktop.
Daemon to export data from the databroker continuously
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import databroker.databroker as db | |
def export_daemon(): | |
last_updated = now | |
while True: | |
last_updated_2 = now | |
hdrs = db(start_time=last_updated)) | |
last_updated = last_updated_2.copy() | |
if hdrs: | |
for hdr in hdrs: | |
try: | |
db.export(new_db, stuff) | |
except: | |
pass | |
# need something more elegent here but I don't know the error for existing record | |
else: | |
sleep(6*50) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment