Beispiel #1
0
    def __call__(self, beginDate, endDate):
        """
		"""
        assert beginDate <= endDate

        logger.info("----- 开始处理:from %s to %s -------" % (beginDate, endDate))
        # today = datetime.date.today()

        # if beginDate >= today:
        # 	return

        # 提取前一天的数据,以作一些额外的运算
        try:
            self.prevData = PVDaily.objects.get(date=beginDate - one_day)
        except PVDaily.DoesNotExist:
            self.prevData = None

        while (beginDate <= endDate):
            logger.info("===== 正在处理 %s =======" % beginDate)

            logger.info("+++++ 开始从LogVisit中更新用户数据到UserData中... +++++++\n")
            tt = Utils.TimeTrack()
            # 先把新用户更新到历史访问列表中
            self.uudflv = UpdateUserDataFromLogVisit()
            self.uudflv(beginDate)
            logger.info("+++++ 数据更新完毕,耗时:%s 秒 +++++++\n" % (tt.stop()))

            t = Utils.TimeTrack()
            self.process_one_day(beginDate)
            logger.info("===== 处理 %s 完毕,耗时: %s 秒。 =======\n" %
                        (beginDate, t.stop()))
            beginDate = beginDate + one_day

        logger.info("----- 处理结束 -------\n\n\n")
Beispiel #2
0
    def __call__(self, beginDate, endDate):
        """
		"""
        assert beginDate <= endDate

        logger.info("----- 开始处理:from %s to %s -------" % (beginDate, endDate))

        # 循环处理每一天的数据
        while (beginDate <= endDate):
            logger.info("===== 正在处理 %s =======" % beginDate)

            logger.info("+++++ 开始从LogVisit中更新用户数据到UserData中... +++++++\n")
            tt = Utils.TimeTrack()
            # 先把新用户更新到历史访问列表中
            self.uudflv = UpdateUserDataFromLogVisit()
            self.uudflv(beginDate)
            logger.info("+++++ 数据更新完毕,耗时:%s 秒 +++++++\n" % (tt.stop()))

            t = Utils.TimeTrack()
            self.process_one_day(beginDate)
            # try:
            # 	au_date = AUDaily.objects.all().order_by('date')[0].date
            # except IndexError:
            # 	au_date = datetime.date.today() - datetime.timedelta(days=2)

            # for d in [1, 2, 3, 4, 5, 6, 7, 15, 30]:

            # 	nd = beginDate - datetime.timedelta(days=d)

            # 	if nd < au_date:
            # 		break
            # 	self.uudflv = UpdateUserDataFromLogVisit()
            # 	self.uudflv(nd)
            # 	self.process_one_day( nd )
            logger.info("===== 处理 %s 完毕,耗时: %s 秒。 =======\n" %
                        (beginDate, t.stop()))
            beginDate = beginDate + one_day

        logger.info("----- 处理结束 -------\n\n\n")