def isLastWorkDayWarn(self): rc = -2 w = self.getLastWorkDay(self.ib.lastworkday) if w is None : self.log.error(' wkday = %s : Please check DB connectivity table' % w) return -5 wd = su.getDtStr(w,'%Y-%m-%d') d=su.getTodayDtStr('%Y-%m-%d') self.log.debug('self.ib.lastworkday = %s date_day = %s today = %s' % (self.ib.lastworkday,w,d)) if d == wd : rc = 0 else : rc = RET_WARN return rc
def _chkSrcReady(self): qryStr = "select max(MeasureDate) MonthDate , 1 isServiceCallsReady from dbo.edw_ServiceCalls" self.ib.user = self.ib.ms_user; self.ib.pwd = self.ib.ms_pwd; self.ib.dbserver = self.ib.ms_dbserver ; self.ib.db = self.ib.ms_db rs = self._getMSSQLNatDS(qryStr) self.log.debug('qryStr = ', qryStr , ' rs ', rs) if rs is None or len(rs) != 1 : return -1 isRdy = rs[0][1] rdtm = su.getDtStr(rs[0][0],'%m%Y') todm = su.getTodayDtStr('%m%Y') nmth = su.getMonthPlusStr(1,rdtm,'%m%Y') self.log.debug("isRdy = %s rdtm=%s todm=%s nmth=%s" % (isRdy,rdtm,todm,nmth)) if isRdy == 1 and nmth == todm : # and sysdate - 1 self.log.info ("Ready to Proceed : rdtm = %s isRdy = %s " % (rdtm,isRdy)) return 0 return 1
def _chkSrcReady(self): qryStr = """ select MonthDate, CAST(isSourcingReady AS int) from dbo.DataReady WHERE MonthDate = (select MAX(MonthDate) from dbo.DataReady)""" self.ib.user = self.ib.ms_user; self.ib.pwd = self.ib.ms_pwd; self.ib.dbserver = self.ib.ms_dbserver ; self.ib.db = self.ib.ms_db rs = self._getMSSQLNatDS(qryStr) self.log.debug('qryStr = ', qryStr , ' rs ', rs) if len(rs) != 1 : return -1 isRdy = rs[0][1] rdtm = su.getDtStr(rs[0][0],'%m%Y') todm = su.getTodayDtStr('%m%Y') nmth = su.getMonthPlusStr(1,rdtm,'%m%Y') self.log.debug("isRdy = %s rdtm=%s todm=%s nmth=%s" % (isRdy,rdtm,todm,nmth)) if isRdy == 1 and nmth == todm : # and sysdate - 1 = dt self.log.info ("Ready to Proceed : rdtm = %s isRdy = %s " % (rdtm,isRdy)) return 0 return 1