Example #1
0
from pythonFrame.myUtils.Util import MyDate
from report.ReportEntity import ReportEntity, ReportDMEntity
from report.ReportMonitor import ReportMonitor

__author__ = 'linzhou208438'
__update__ = '2015/6/24'


class A(object):
    def __init__(self, map):
        print map.map_store


if __name__ == '__main__':

    # reportMysql=ReportMysql(ReportMysql.conn_space_params)
    # re = reportMysql.select_map_store()
    #print re.__len__()
    # mysqlWrap = ReportMysql(ReportMysql.conn_space_params)
    # mysqlWrap.insert_update_report(map_store=re,update_fields=ReportDMEntity().__dict__)
    monitorReport = ReportMonitor()

    mydatea = 20150623
    monitorReport.__setattr__("11", MyDate(mydatea))
    print monitorReport.mydate.get_now()
    print monitorReport.__dict__
    print monitorReport.map_store
    print monitorReport.__getattribute__("map_store")
    a = A(monitorReport)
Example #2
0
         -DsendMsg              eg: .py -DsendMsg phone1,phone2 message
         -DupdateAssignField    default all
         -Dadmobile             ad mobile data from oracle to mysql

         if you want to monitor python url request please exec :
         tail -f /home/qs/scripts/video_report_yyyymm/yyyyMMdd/monitor.log

         notice: all reference code in video_report_yyyymm directory
         eg: pythonFrame        provide basic component
             report             business service closely related

         '''

        exit()

    monitorReport = ReportMonitor()

    fileRead = ReportReadFile(monitorReport)
    fileWrite = FileWrite()

    jsonParallel = ReportJsonParallel(monitorReport)
    jsonSerial = ReportJsonSerial(monitorReport)

    mysqlWrap = ReportMysql(ReportMysql.conn_formal_params, monitorReport)
    #mysqlWrap = ReportMysql(ReportMysql.conn_space_params,monitorReport)

    if cmp(sys.argv[1], '-Dsave') == 0:
        mydate = Util.get_yesterday()
        if len(sys.argv) == 3:
            mydate = sys.argv[2]
        monitorReport.__setattr__("mydate", MyDate(mydate))
         -DsendMsg              eg: .py -DsendMsg phone1,phone2 message
         -DupdateAssignField    default all
         -Dadmobile             ad mobile data from oracle to mysql

         if you want to monitor python url request please exec :
         tail -f /home/qs/scripts/video_report_yyyymm/yyyyMMdd/monitor.log

         notice: all reference code in video_report_yyyymm directory
         eg: pythonFrame        provide basic component
             report             business service closely related

         '''

        exit()

    monitorReport = ReportMonitor()

    fileRead = ReportReadFile(monitorReport)
    fileWrite = FileWrite()

    jsonParallel = ReportJsonParallel(monitorReport)
    jsonSerial = ReportJsonSerial(monitorReport)

    mysqlWrap = ReportMysql(ReportMysql.conn_formal_params,monitorReport)
    #mysqlWrap = ReportMysql(ReportMysql.conn_space_params,monitorReport)

    if cmp(sys.argv[1], '-Dsave') == 0:
        mydate = Util.get_yesterday()
        if len(sys.argv) == 3:
            mydate = sys.argv[2]
        monitorReport.__setattr__("mydate",MyDate(mydate))
Example #4
0
        "passwd": "linhailei"
    }

    def __init__(self, monitorReport, conn_report_params=None):
        OracleWrap.__init__(self, conn_report_params)
        self.monitorReport = monitorReport

    def write_rows_file(self, path):
        #sql = 'select v_id,max_adv,uv,view_all_uv,stock,occu,pos1,pos2,pos3,pos4,pos5,t_occu from dwpdata.core_mobile_pgc where sver is not null and substr(sver,0,1)>=5 and  data_date=%s'
        sql = "select v_id,sum(max_adv),sum(uv),sum(view_all_uv),sum(stock),sum(occu),sum(pos1),sum(pos2),sum(pos3),sum(pos4),sum(pos5),sum(t_occu) from dwpdata.core_mobile_pgc where sver is not null   and sver <> 'null'  and  regexp_like(sver, '^\d')  and substr(sver,0,1)>=5  and  data_date=%s group by v_id "
        Util.printf(sql % self.monitorReport.mydate.get_now())
        rows = self.oracle_fetchall(sql % self.monitorReport.mydate.get_now())
        self.save_rows(rows, path)

    def save_rows(self, rows, path):
        file_write = open(path, 'w')
        val = []
        for row in rows:
            for i in range(12):
                val.append(str(row[i]))
            file_write.write("  ".join(val) + "\n")
            val = []
        file_write.close()


if __name__ == '__main__':
    monitorReport = ReportMonitor()
    monitorReport.__setattr__("mydate", MyDate(20150726))
    reportMysql = ReportMysql(ReportMysql.conn_space_params, monitorReport)
    reportMysql.check_create_table(26)
Example #5
0
class ReportOracle(OracleWrap):
    conn_oracle_params = {"host": "10.10.34.48", "user": "******", "db": "videodb",
                          "passwd": "linhailei"}

    def __init__(self, monitorReport,conn_report_params=None):
        OracleWrap.__init__(self, conn_report_params)
        self.monitorReport=monitorReport

    def write_rows_file(self, path):
        #sql = 'select v_id,max_adv,uv,view_all_uv,stock,occu,pos1,pos2,pos3,pos4,pos5,t_occu from dwpdata.core_mobile_pgc where sver is not null and substr(sver,0,1)>=5 and  data_date=%s'
        sql = "select v_id,sum(max_adv),sum(uv),sum(view_all_uv),sum(stock),sum(occu),sum(pos1),sum(pos2),sum(pos3),sum(pos4),sum(pos5),sum(t_occu) from dwpdata.core_mobile_pgc where sver is not null   and sver <> 'null'  and  regexp_like(sver, '^\d')  and substr(sver,0,1)>=5  and  data_date=%s group by v_id "
        Util.printf(sql % self.monitorReport.mydate.get_now() )
        rows = self.oracle_fetchall(sql % self.monitorReport.mydate.get_now())
        self.save_rows(rows, path)

    def save_rows(self, rows, path):
        file_write = open(path, 'w')
        val = []
        for row in rows:
            for i in range(12):
                val.append(str(row[i]))
            file_write.write("  ".join(val) + "\n")
            val = []
        file_write.close()

if __name__ == '__main__':
    monitorReport = ReportMonitor()
    monitorReport.__setattr__("mydate",MyDate(20150726))
    reportMysql=ReportMysql(ReportMysql.conn_space_params,monitorReport)
    reportMysql.check_create_table(26)
Example #6
0
from pythonFrame.myUtils.Util import MyDate
from report.ReportEntity import ReportEntity, ReportDMEntity
from report.ReportMonitor import ReportMonitor

__author__ = 'linzhou208438'
__update__ = '2015/6/24'

class A(object):
    def __init__(self,map):
        print map.map_store


if __name__ == '__main__':

    # reportMysql=ReportMysql(ReportMysql.conn_space_params)
    # re = reportMysql.select_map_store()
    #print re.__len__()
    # mysqlWrap = ReportMysql(ReportMysql.conn_space_params)
    # mysqlWrap.insert_update_report(map_store=re,update_fields=ReportDMEntity().__dict__)
    monitorReport = ReportMonitor()

    mydatea=20150623
    monitorReport.__setattr__("11",MyDate(mydatea))
    print monitorReport.mydate.get_now()
    print monitorReport.__dict__
    print monitorReport.map_store
    print monitorReport.__getattribute__("map_store")
    a=A(monitorReport)