def bootstrap(): """build things up.""" # sync pgconn = get_dbconn("mesosite") cursor = pgconn.cursor() load_stations(cursor) pgconn.close() ldmbridge.LDMProductFactory(MyProductIngestor()) reactor.run()
def main(_res): """ Go main Go! """ log.msg("main() fired!") jobs = DeferredQueue() ingest = MyProductIngestor() ingest.jobs = jobs ldmbridge.LDMProductFactory(ingest) for _ in range(6): cooperate(worker(jobs)) lc = LoopingCall(save_current) lc.start(373, now=False) lc2 = LoopingCall(service_guard, jobs) lc2.start(61, now=False)
(nws.afos.strip(), nws.valid, nws.source, nws.wmo), ) if txn.rowcount == 1: log.msg("Duplicate: %s" % (nws.get_product_id(), )) return txn.execute( "INSERT into products (pil, data, entered, " "source, wmo) VALUES(%s, %s, %s, %s, %s)", (nws.afos.strip(), nws.text, nws.valid, nws.source, nws.wmo), ) if MANUAL or nws.afos[:3] in MEMCACHE_EXCLUDE: return return nws if __name__ == "__main__": # Go MANUAL = False UTCNOW = None if len(sys.argv) == 6 and sys.argv[1] == "manual": MANUAL = True UTCNOW = utc( int(sys.argv[2]), int(sys.argv[3]), int(sys.argv[4]), int(sys.argv[5]), ) ldmbridge.LDMProductFactory(MyProductIngestor()) reactor.run() # @UndefinedVariable
def main(): """Our main method""" ldmbridge.LDMProductFactory(MyProductIngestor()) reactor.run() # @UndefinedVariable
def ready(_bogus): """We are ready to ingest""" reactor.callLater(20, cleandb) # @UndefinedVariable ldmbridge.LDMProductFactory(MyProductIngestor())
def ready(_): """ cb when our database work is done """ ldmbridge.LDMProductFactory(MyProductIngestor())
tokens = re.findall("ATTN (WFOS|RFCS)(.*)", raw) channels = [] for tpair in tokens: for center in re.findall(r"([A-Z]+)\.\.\.", tpair[1]): channels.append("SPENES.%s" % (center, )) xtra = {"product_id": product_id} xtra["channels"] = ",".join(channels) xtra["twitter"] = ("NESDIS issues Satellite Precipitation " "Estimates %s?pid=%s") % (PYWWA_PRODUCT_URL, product_id) body = ("NESDIS issues Satellite Precipitation Estimates %s?pid=%s") % ( PYWWA_PRODUCT_URL, product_id, ) htmlbody = ("<p>NESDIS issues " "<a href='%s?pid=%s'>Satellite Precipitation Estimates</a>" "</p>") % (PYWWA_PRODUCT_URL, product_id) jabber.send_message(body, htmlbody, xtra) def killer(): """Stop Right Now!""" reactor.stop() if __name__ == "__main__": jabber = common.make_jabber_client("spe_parser") ldmbridge.LDMProductFactory(MyProductIngestor(dedup=True)) reactor.run()
def main(): """Go Main Go""" ldmbridge.LDMProductFactory(MyProductIngestor()) reactor.run() # @UndefinedVariable
def main(): """Go Main""" ldmbridge.LDMProductFactory(myProductIngestor(isbinary=True)) reactor.run() # @UndefinedVariable
def ready(_): """callback once our database load is done""" ingest = MyProductIngestor() ldmbridge.LDMProductFactory(ingest) cleandb() load_ignorelist()
def ready(_dummy): """ cb when our database work is done """ ldmbridge.LDMProductFactory(MyProductIngestor(dedup=True))
def on_ready(_unused, mesosite): """ready to fire things up""" log.msg("on_ready() has fired...") mesosite.close() ingest = MyProductIngestor(isbinary=True) ldmbridge.LDMProductFactory(ingest)
def ready(_bogus): """we are ready to go""" ldmbridge.LDMProductFactory(myProductIngestor())