Esempio n. 1
0
def intradaysnapshot():
	logger.info("intraday snapshot")
	cmdline = "LON_MM_EVENING_INTRADAY GFTBSGL --force-priority 100 --job MKT_SNAPSHOT_LIVE_FASTINTRA --user-name SG435551 --now  --no-tfc --sub-batch _FAST --ignore-day"
	ntmad_ret = ntmadsubmit(cmdline)
	jobid = ntmad_ret["job_id"]
	mad = maddb("MADBUKL", {"select_progress":"""select job_id, proportion_done, sts_cod from exo_evt_log where job_id in (%s)"""})

	while not mad.isdone(jobid):
		time.sleep(60*5)

	logger.info("intradaysnapshot done")
Esempio n. 2
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}))
Esempio n. 3
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)