Exemple #1
0
 def _handle_file(self, filepath):
     stamp = os.path.splitext(os.path.basename(filepath))[0]
     print >>sys.stderr, "File '{0}'".format(stamp)
     date = parse_rfc3339_stamp(stamp, ' ')
     print >>sys.stderr, "Loading batch: ", date
     with open(filepath, "rb") as f:
         data = f.read()
     serverdatarefinery.put_json_to_database(date, data)
Exemple #2
0
 def handle(self, *args, **options):
     _errlog("running doomlister {0}".format(_now()))
     with tempfile.TemporaryFile() as f:
         p = subprocess.Popen(['doomlister'], stdout=f)
         if p.wait() != 0:
             raise Exception('doomlister failed')
         _errlog("doomlister completed successfully")
         f.seek(0)
         data = f.read()
     _errlog("putting data to database")
     serverdatarefinery.put_json_to_database(timezone.now(), data)
     _errlog("collecting completed {0}".format(_now()))
     _errlog("building presentation")
     build_presentation(incremental=True)
     _errlog("completed building presentation {0}".format(_now()))