예제 #1
0
import os
import sys
sys.path.append('/data/xce/zhaohui.tang/python/util')
from util import Util
import time
import gzip
import re 
from mid_mail import MidMail
from AdQualityAdapter import *

midmail = MidMail()
util = Util()

stat_map = {}

class StatElement(object):
  def __init__(self, user_key, group_id, time):
    self.pv_count = 0
    self.click_count= 0
    self.user_key = user_key
    self.group_id = group_id
    self.time = time
  def add(self, mp):
    print self.pv_count
    if("pvlog" in mp):
      self.pv_count += 1
    elif("clicklog" in mp):
      self.click_count += 1
  def insertIntoMap(self, stat_map):
    stat = AdStat()
    stat.userKey = self.user_key 
예제 #2
0
import sys
sys.path.append('/data/xce/zhaohui.tang/python/util')
from mid_db import MidDb
from util import Util
import MySQLdb
import time
from logger import *
from mid_mail import MidMail
sqlstrs = []

logger = Logger("log_h", "/data/xce/zhaohui.tang/python/log", "hourly")
middb = MidDb()
middb.initDbConnection('10.3.22.69', 'work@RR', 'Geeker4ZolZ', 'adn')
#middb.initDbConnection('10.2.19.161', 'xce', 'xce1234', 'adn')

midmail = MidMail()
senderr = 0
senderr_msg = ""

util = Util()


class StatElement(object):
    def __init__(self, user_key, group_id, db_time):
        counts = {}
        counts["pv_count"] = 0
        counts["click_count"] = 0
        self.counts = counts
        self.user_key = user_key
        self.group_id = group_id
        self.db_time = db_time
예제 #3
0
#! /usr/bin/env python
import sys
import traceback, time
import StringIO
from mid_mail import MidMail

midmail = MidMail()


class Logger(object):
    def __init__(self,
                 name="log",
                 path="/data/xce/zhaohui.tang/log",
                 type="hourly"):
        self.name = name
        self.path = path
        self.type = type
        if type == "hourly":
            self.log_file = open(
                path + "/" + name + "." + time.strftime("%Y-%m-%d-%H"), "a")
        elif type == "minutely":
            self.log_file = open(
                path + "/" + name + "." + time.strftime("%Y-%m-%d-%H-%M"), "a")

    def info(self, str):  # log and print
        print str
        self.log_file.write(str + "\n")

    def log(self, str):
        self.log_file.write(str + "\n")
예제 #4
0
import sys
sys.path.append('/data/xce/zhaohui.tang/python/util')
from mid_db import MidDb
from util import Util
import MySQLdb
import time
from logger import *
from mid_mail import MidMail
sqlstrs = []

logger = Logger("log_h", "/data/xce/zhaohui.tang/python/log", "hourly")
middb = MidDb()
middb.initDbConnection('10.3.22.69', 'work@RR', 'Geeker4ZolZ', 'adn')
#middb.initDbConnection('10.2.19.161', 'xce', 'xce1234', 'adn')

midmail = MidMail()
senderr = 0
senderr_msg = ""

util = Util()
class StatElement(object):
	def __init__(self, user_key, group_id, db_time):
		counts= {}
		counts["pv_count"] = 0
		counts["click_count"] = 0
		self.counts = counts
		self.user_key = user_key
		self.group_id = group_id
		self.db_time = db_time
	def add(self, mp):
		if("pvlog" in mp):
예제 #5
0
import os
import sys

sys.path.append('/data/xce/zhaohui.tang/python/util')
from util import Util
import time
import gzip
import re
from mid_mail import MidMail
from AdQualityAdapter import *

midmail = MidMail()
util = Util()

stat_map = {}


class StatElement(object):
    def __init__(self, user_key, group_id, time):
        self.pv_count = 0
        self.click_count = 0
        self.user_key = user_key
        self.group_id = group_id
        self.time = time

    def add(self, mp):
        print self.pv_count
        if ("pvlog" in mp):
            self.pv_count += 1
        elif ("clicklog" in mp):
            self.click_count += 1