Skip to content

Instantly share code, notes, and snippets.

@CJ-Wright
Created March 21, 2017 21:24
Show Gist options
  • Save CJ-Wright/9eba5adcee010bc8f6ea083a2df8b268 to your computer and use it in GitHub Desktop.
Save CJ-Wright/9eba5adcee010bc8f6ea083a2df8b268 to your computer and use it in GitHub Desktop.
Daemon to export data from the databroker continuously
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