def __init__(self,type,list): self.cdn_url_purge = public.cdn_url_purge self.cdn_url_checkstatus = public.cdn_url_checkstatus self.username = public.username self.passwd = public.passwd self.pad = public.pad self.PathPrefix = public.PathPrefix self.PathDomain = public.PathDomain self.logger = public.getLog(type) self.TypeAliases = type self.FlushPrefix = public.FlushPrefix self.SquidServer = public.SquidServer self.SquidPort = public.SquidPort self.list = list self.AllFilesPathList = [] self.StoWebHdfs = WebHadoop(public.HdfsIntGateway,14000,"cloudiyadatauser",self.logger) if type == "file": type = "item" cdnpaths = "" for path in list: cdnpaths = "&path=%s%s"%(self.PathPrefix,path) + cdnpaths elif type == "dir": type = "wildcard" cdnpaths = "" for path in list: cdnpaths = "&path=%s%s/*"%(self.PathPrefix,path) + cdnpaths self.type = type self.list = list self.cdnpaths = cdnpaths self.logger.info(" Purge Base Info \n \ Purge Type : %s \n \ Purge List : %s \n \ CDN Purge Paths : %s \n \ "%(self.type,self.list,self.cdnpaths)) threading.Thread.__init__(self)
def __init__(self,type,list,pad,LogKeyName): self.cdn_url_purge = public.cdn_url_purge self.cdn_url_checkstatus = public.cdn_url_checkstatus self.username = public.username self.passwd = public.passwd self.pad = pad self.logger = public.getLog(LogKeyName) self.TypeAliases = type self.FlushPrefix = "http://" + self.pad self.SquidServer = public.SquidServer self.SquidPort = public.SquidPort self.list = list self.AllFilesPathList = [] self.StoWebHdfs = WebHadoop(public.HdfsIntGateway,14000,"cloudiyadatauser",self.logger) if type == "file": type = "item" cdnpaths = "" for path in list: cdnpaths = "&path=%s"%(path) + cdnpaths elif type == "dir": type = "wildcard" cdnpaths = "" for path in list: cdnpaths = "&path=%s/*"%(path) + cdnpaths self.type = type self.list = list self.cdnpaths = cdnpaths self.logger.info(" Purge Base Info \n \ Purge Type : %s \n \ Purge Pad : %s \n \ Purge List : %s \n \ CDN Purge Paths : %s \n \ "%(self.type,self.pad,self.list,self.cdnpaths)) threading.Thread.__init__(self)
# -*- encoding:utf-8 -*- # --/ # 主程序 # 获取待处理队列中数据,分类进行cache purge分别在squid和cdn # --/ import sys import redis import public from PurgeCache import exeCachePurge logger = public.getLog("main") #获取待处理队列中数据 redispool = redis.ConnectionPool(host=public.RedisIP, port=public.RedisPort, db=0) redata = redis.Redis(connection_pool=redispool) redpipe = redata.pipeline() for i in xrange(public.PerHandleNum): redpipe.lpop(public.PendingHandleListName) PathsList = redpipe.execute() #规范及分离数据 PathsList_NoNone = [i for i in PathsList if i] if len(PathsList_NoNone) == 0: logger.info("NO HAVE PATHS NEED TO PURGE") sys.exit() else:
# -*- encoding:utf-8 -*- # --/ # 主程序 # 获取待处理队列中数据,分类进行cache purge分别在squid和cdn # --/ import sys import redis import public from PurgeCache import exeCachePurge logger = public.getLog("main") #获取待处理队列中数据 redispool = redis.ConnectionPool(host=public.RedisIP,port=public.RedisPort,db=0) redata = redis.Redis(connection_pool=redispool) redpipe = redata.pipeline() for i in xrange(public.PerHandleNum): redpipe.lpop(public.PendingHandleListName) PathsList = redpipe.execute() #规范及分离数据 PathsList_NoNone = [i for i in PathsList if i] if len(PathsList_NoNone) == 0: logger.info("NO HAVE PATHS NEED TO PURGE") sys.exit() else: FilePathsList = [i for i in PathsList_NoNone if "." in i] FilePathsList = [i for i in FilePathsList if "A0.xml" not in i and "A05.xml" not in i and "A0A.xml" not in i]