Exemplo n.º 1
0
def sendMsg(body=None):
    subject = "[约车时间]"  #% (_file, _func, ','.join(alerts['vers']))
    mail_to = ("*****@*****.**", "*****@*****.**")
    mail_from = "*****@*****.**"
    credentails = ("xiaotian.yan", "yan714257")
    yclog.info("%s\n%s" % (subject, body))

    yclog.info("Sending notice email -> %s" % "|".join(mail_to))
    sendMail(mail_from, credentails, mail_to, subject.decode("utf8"), body.decode("utf8"))
Exemplo n.º 2
0
def sendMsg(body=None):
    subject = "[约车时间]"  #% (_file, _func, ','.join(alerts['vers']))
    mail_to = ('*****@*****.**', '*****@*****.**')
    mail_from = '*****@*****.**'
    credentails = ('xiaotian.yan', 'yan714257')
    yclog.info('%s\n%s' % (subject, body))

    yclog.info('Sending notice email -> %s' % '|'.join(mail_to))
    sendMail(mail_from, credentails, mail_to, subject.decode('utf8'),
             body.decode('utf8'))
Exemplo n.º 3
0
        strWhere = 'lat=0 or lon=0'
        sql = wppdb.sqls['SQL_INSERT_SELECT'] % ( tab_rd_noloc, '*', '%s WHERE %s'%(tab_rd,strWhere) )
        wppdb.cur.execute(sql)
        sql = wppdb.sqls['SQL_DELETE'] % (tab_rd, strWhere)
        wppdb.cur.execute(sql)
        wppdb.close()
        print 'Move noloc rawdata -> |%s|' % tab_rd_noloc
        if alerts['vers']:
            # Send alert email to admin.
            _func = sys._getframe().f_code.co_name
            subject = "[!]WPP ERROR: %s->%s, ver: [%s]" % (_file, _func, ','.join(alerts['vers']))
            body = ( errmsg['db'] % (tab_rd,'insert',alerts['details'],getIP()['eth0'],ctime()) ).decode('utf-8')
            print alerts['details']
            print subject#, body
            print 'Sending alert email -> %s' % mailcfg['to']
            sendMail(mailcfg['from'],mailcfg['userpwd'],mailcfg['to'],subject,body)

def crawlAreaLocData():
    """
    1) fetch 100 records with flag area_ok = 0.
    2) try areaLocation(laccid), if OK, then update flag area_ok =1 and quit; else goto 2).
    3) try googleAreaLocation(latlon), if OK, then get geoaddr:[province,city,district]; 
       else |wpp_uprecsinfo|.area_try += 1 and quit.
    4) search area_code for the found district, insert area location 
       (laccid,areacode,areaname_cn) into |wpp_cellarea|, and update flag area_ok = 1.
    """
    fail_history = {}
    dbips = DB_OFFLINE
    for dbip in dbips:
        dbsvr = dbsvrs[dbip]
        wppdb = WppDB(dsn=dbsvr['dsn'], dbtype=dbsvr['dbtype'])
Exemplo n.º 4
0
        wppdb.cur.execute(sql)
        sql = wppdb.sqls['SQL_DELETE'] % (tab_rd, strWhere)
        wppdb.cur.execute(sql)
        wppdb.close()
        print 'Move noloc rawdata -> |%s|' % tab_rd_noloc
        if alerts['vers']:
            # Send alert email to admin.
            _func = sys._getframe().f_code.co_name
            subject = "[!]WPP ERROR: %s->%s, ver: [%s]" % (
                _file, _func, ','.join(alerts['vers']))
            body = (errmsg['db'] % (tab_rd, 'insert', alerts['details'],
                                    getIP()['eth0'], ctime())).decode('utf-8')
            print alerts['details']
            print subject  #, body
            print 'Sending alert email -> %s' % mailcfg['to']
            sendMail(mailcfg['from'], mailcfg['userpwd'], mailcfg['to'],
                     subject, body)


def crawlAreaLocData():
    """
    1) fetch 100 records with flag area_ok = 0.
    2) try areaLocation(laccid), if OK, then update flag area_ok =1 and quit; else goto 2).
    3) try googleAreaLocation(latlon), if OK, then get geoaddr:[province,city,district]; 
       else |wpp_uprecsinfo|.area_try += 1 and quit.
    4) search area_code for the found district, insert area location 
       (laccid,areacode,areaname_cn) into |wpp_cellarea|, and update flag area_ok = 1.
    """
    fail_history = {}
    dbips = DB_OFFLINE
    for dbip in dbips:
        dbsvr = dbsvrs[dbip]