Beispiel #1
0
def bootstrap():
    """build things up."""
    # sync
    pgconn = get_dbconn("mesosite")
    cursor = pgconn.cursor()
    load_stations(cursor)
    pgconn.close()

    ldmbridge.LDMProductFactory(MyProductIngestor())
    reactor.run()
Beispiel #2
0
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)
Beispiel #3
0
            (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
Beispiel #4
0
def main():
    """Our main method"""
    ldmbridge.LDMProductFactory(MyProductIngestor())
    reactor.run()  # @UndefinedVariable
Beispiel #5
0
def ready(_bogus):
    """We are ready to ingest"""
    reactor.callLater(20, cleandb)  # @UndefinedVariable
    ldmbridge.LDMProductFactory(MyProductIngestor())
Beispiel #6
0
def ready(_):
    """ cb when our database work is done """
    ldmbridge.LDMProductFactory(MyProductIngestor())
Beispiel #7
0
    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()
Beispiel #8
0
def main():
    """Go Main Go"""
    ldmbridge.LDMProductFactory(MyProductIngestor())
    reactor.run()  # @UndefinedVariable
Beispiel #9
0
def main():
    """Go Main"""
    ldmbridge.LDMProductFactory(myProductIngestor(isbinary=True))
    reactor.run()  # @UndefinedVariable
Beispiel #10
0
def ready(_):
    """callback once our database load is done"""
    ingest = MyProductIngestor()
    ldmbridge.LDMProductFactory(ingest)
    cleandb()
    load_ignorelist()
Beispiel #11
0
def ready(_dummy):
    """ cb when our database work is done """
    ldmbridge.LDMProductFactory(MyProductIngestor(dedup=True))
Beispiel #12
0
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)
Beispiel #13
0
def ready(_bogus):
    """we are ready to go"""
    ldmbridge.LDMProductFactory(myProductIngestor())