Exemplo n.º 1
0
    def __init__(self):
        handlers = [
                (r"/", MainHandler),
                (r"/interstellar/rampdiff", RampDiff),
                (r"/interstellar/rebuildindex", RebuildIndex),
                (r"/ntmadservice/runrisk", runriskHander),
                (r"/ntmadservice/queryjob", queryjobsHandler)
        ]
        settings = dict(debug=True)
        tornado.web.Application.__init__(self, handlers, **settings)

        self.menus = json.load(open("menuConfig.json"))
        self.menus_mtime = os.path.getmtime(os.path.abspath("menuConfig.json"))
        self.mad = maddb(json.load(open("madQuery.json")))
        self.mongo = mongodb('mongodb://localhost:3001/', self.mad)
        self.sysdate = datetime.today()
        self.reglib = list(self.mongo.meteor.errtemplate.find({},{"_id":0}))
Exemplo n.º 2
0
def jobqueueRefresh():
    menus = json.load(open("menuConfig.json"))
    sql = json.load(open("madQuery.json"))

    mad = maddb(sql)
    mongo = mongodb("mongodb://localhost:3001/")

    baseDt = datetime.strftime(datetime.today() - timedelta(days=1), "%d/%m/%Y")
    for loc, v in menus.items():
        for farm, batches in v["monitor"].items():
            if "MAD" in farm:
                for batch, jobs in batches.items():
                    if len(jobs):
                        df = mad.progress_by_jobs(farm, baseDt, batch, ",".join(map(lambda x: "'%s'" % x, jobs)))
                        mongo.jobqueueUpdate(df)
                    else:
                        df = mad.progress_by_batch(farm, baseDt, batch)
                        mongo.jobqueueUpdate(df)