当前位置: 首页>>代码示例>>Python>>正文


Python LogStream类代码示例

本文整理汇总了Python中LogStream的典型用法代码示例。如果您正苦于以下问题:Python LogStream类的具体用法?Python LogStream怎么用?Python LogStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了LogStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, conf="testIFPImage", userName="", baseTime=None,
      timeRange=None, usrTimeRange=None):
        from com.raytheon.uf.viz.core.localization import LocalizationManager
        self.site = LocalizationManager.getInstance().getCurrentSite()
        
        self._topo = 0
                
        # import the config file
        self.config = __import__(conf)
        loadConfig.loadPreferences(self.config)
        
        self.baseTime = baseTime

        # Create GFEPainter first and get DataManager from painter
        self.viz = self.createPainter()
        self.dm = self.viz.getDataManager();

        LogStream.logEvent("Configuration File: ", conf)

        self.pgons = None
        self.imgParm = None
        self.ipn = self.getConfig('Png_image', '')

        # user named time range specified?
        if usrTimeRange is not None:
            s_tr = self.dm.getSelectTimeRangeManager().getRange(usrTimeRange)
            if s_tr is None:
                LogStream.logProblem(usrTimeRange, \
                  " is not a valid time range name.")
                sys.exit(1)
            else:
                tr = TimeRange.TimeRange(s_tr.toTimeRange())
                self.pngTimeRange = tr
        else:
            self.pngTimeRange = timeRange
开发者ID:KeithLatteri,项目名称:awips2,代码行数:35,代码来源:PngWriter.py

示例2: purgeOldSavedTables

    def purgeOldSavedTables(self, purgeTime):
        #purges old saved tables

        if self._activeTableFilename is None:
            raise Exception, "purgeOldSavedTables without filename"

        #calculate purge time
        purgeTime = time.time() - (purgeTime * 3600)

        #directory and files
        directory = os.path.join(os.path.dirname(self._activeTableFilename), "backup")
        baseN = os.path.basename(self._activeTableFilename)
        idx = baseN.find(".")
        if idx != -1:
            baseN = baseN[0:idx]
        files = glob.glob(directory + "/*" + baseN + "*.gz")

        #delete files older than purgeTime
        for f in files:
            try:
                modTime = os.stat(f)[stat.ST_MTIME] 
                if modTime < purgeTime:
                    os.remove(f)
                    LogStream.logDebug("Removing old file: ", f)
            except:
                LogStream.logProblem("Problem Removing old backup file: ", f,
                  LogStream.exc())
开发者ID:KeithLatteri,项目名称:awips2,代码行数:27,代码来源:VTECTableUtil.py

示例3: _dtgFromDDHHMM

    def _dtgFromDDHHMM(self, dtgString):
        #utility function taking a ddhhmm string
        #group1=day, group2=hour, group3=minute
        #returns a time object
        wmo_day = int(dtgString[0:2])
        wmo_hour = int(dtgString[2:4])
        wmo_min = int(dtgString[4:6])

        gmtuple = time.gmtime(self._time)
        wmo_year = gmtuple[0]  #based on current time
        wmo_month = gmtuple[1] #based on current time
        current_day = gmtuple[2]
        if current_day - wmo_day > 15:
            # next  month
            wmo_month = wmo_month + 1
            if wmo_month > 12:
                wmo_month = 1
                wmo_year = wmo_year + 1
        elif current_day - wmo_day < -15:
            # previous month
            wmo_month = wmo_month -1
            if wmo_month < 1:
                wmo_month = 12
                wmo_year = wmo_year - 1

        s = `wmo_year` + "%02i" % wmo_month + "%02i" % wmo_day + \
          "%02i" % wmo_hour + "%02i" % wmo_min + "UTC"
        timeTuple = time.strptime(s, "%Y%m%d%H%M%Z")
        wmoTime = time.mktime(timeTuple)   #TZ is GMT0, so this mktime works

        LogStream.logVerbose("DTG=",dtgString, "IssueTime=",
          time.asctime(time.gmtime(wmoTime)))

        return wmoTime
开发者ID:KeithLatteri,项目名称:awips2,代码行数:34,代码来源:WarningDecoder.py

示例4: startThreads

 def startThreads(self):
     LogStream.logEvent("Starting Threads")
     self.t1 = threading.Thread(target=self.broadcast)
     self.t1.setDaemon(True)
     self.t1.start()
     self.t2 = threading.Thread(target=self.discover)
     self.t2.setDaemon(True)
     self.t2.start()
开发者ID:KeithLatteri,项目名称:awips2,代码行数:8,代码来源:msg_send.py

示例5: _getTextCaptureCategories

 def _getTextCaptureCategories(self):
     #gets the list of product categories that need their text captured.
     #if the list is empty, then all products are captured into the
     #active table and None is returned.
     cats = getattr(VTECPartners, "VTEC_CAPTURE_TEXT_CATEGORIES", [])
     if len(cats) == 0:
         return None
     LogStream.logDebug("Text Capture Categories: ", cats)
     return cats
开发者ID:KeithLatteri,项目名称:awips2,代码行数:9,代码来源:ActiveTable.py

示例6: main

def main():
    LogStream.logEvent("setupTextEA Starting")

    try:
        obj = setupTextEA()
        obj.process()
    except Exception, e:
        LogStream.logProblem(LogStream.exc())
        sys.exit(1)
开发者ID:KeithLatteri,项目名称:awips2,代码行数:9,代码来源:SetupTextEA.py

示例7: _remapPil

 def _remapPil(self, phen, sig, pil):
     # remaps the product pil for certain phen/sig/pils.  The VTECDecoder
     # needs to relate hazards through all states from the same pil. Some
     # short-fused hazards issue in one pil and followup/cancel in
     # another pil.
     key = (phen, sig, pil)
     rPil = self._mappedPils.get(key,  pil)
     if rPil != pil:
         LogStream.logEvent("Remapped Pil", key, "->", rPil)
     return rPil
开发者ID:KeithLatteri,项目名称:awips2,代码行数:10,代码来源:WarningDecoder.py

示例8: decodeTimeString

def decodeTimeString(timeStr):
    try:
        intTime = time.strptime(timeStr, "%Y%m%d_%H%M")
    except:
        LogStream.logProblem(timeStr, \
          "is not a valid time string.  Use YYYYMMDD_HHMM")
        raise SyntaxError, "Bad date format YYYYMMDD_HHMM"

    return AbsTime.absTimeYMD(intTime[0], intTime[1], intTime[2],
      intTime[3], intTime[4], 0)
开发者ID:KeithLatteri,项目名称:awips2,代码行数:10,代码来源:PngWriter.py

示例9: initParms

    def initParms(self):
        dm = self.dm
        btext = self.getConfig('Png_parms', [])
        if len(btext) == 0:
            LogStream.logProblem("Png_parms missing or empty")
            raise UserWarning, "Png_parms missing or empty"

        if "Topo" in btext:
            self._topo = 1
            btext.remove("Topo")

        ip = self.getConfig('Png_image', None)
        if ip == "Topo":
            self._topo = 1

        # Attempt to decode pseudo parms in the config file
        from com.raytheon.uf.common.dataplugin.gfe.db.objects import ParmID
        from com.raytheon.uf.common.dataplugin.gfe.weatherelement import WEItem, WEGroup
        wegroup = WEGroup()
        wegroup.setName('png')
        weItems = jep.jarray(len(btext), WEItem)
        for i in range(len(btext)):
            text = btext[i].split(' ')
            parmid = text[0] + '_00000000_0000'            
            parmid = string.replace(parmid, ':', ':SITE_GRID_')            
            cycles = text[1]            
            p = ParmID(parmid)
            weItems[i] = WEItem(p, int(cycles))
        wegroup.setWeItems(weItems)            

        # make the text file
        # id = AFPS.TextFileID("png",'BUNDLE')
        # txtfile = AFPS.TextFile(id, ctext)

        # process the bundle
        dbIDs = dm.getParmManager().getAvailableDbs()
        availableParmIDs = []
        for i in range(dbIDs.size()):
            dbID = dbIDs.get(i)
            nextAvailable = dm.getParmManager().getAvailableParms(dbID)
            for next in nextAvailable: 
                availableParmIDs.append(next)
        
        size = len(availableParmIDs)
        jparmIds = jep.jarray(size, ParmID)
        for i in range(size):
            jparmIds[i] = availableParmIDs[i]
        vv = dm.getWEGroupManager().getParmIDs(wegroup,jparmIds)
        if len(vv) == 0:
            LogStream.logProblem("Png_parms contains no valid weather "
                                 + "elements")
            raise UserWarning, "Png_parms contains no valid weather elements"
        
        return vv
开发者ID:KeithLatteri,项目名称:awips2,代码行数:54,代码来源:PngWriter.py

示例10: main

def main():
    path = siteConfig.GFESUITE_LOGDIR+"/"
    if(os.path.exists(path)):
        purgeAge = IFPServerConfigManager.getServerConfig(siteConfig.GFESUITE_SITEID).logFilePurgeAfter()
        duration = 86400 * purgeAge
        cutoffTime = time.strftime("%Y%m%d", time.gmtime(time.time() - duration))
        LogStream.logEvent("Purging GFE log files older than", purgeAge, "days")
        dirList = os.listdir(path)

        for fname in dirList:
            if fname < cutoffTime:
                shutil.rmtree(path + fname)
开发者ID:KeithLatteri,项目名称:awips2,代码行数:12,代码来源:logPurge.py

示例11: _expandUGC

    def _expandUGC(self, ugcString):
        #expand a UGC string into its individual UGC codes, returns the list.
        ugc_list = []    #returned list of ugc codes
        ugc_line = None
        if ( self._hasDTG ):
            ugc_line = ugcString[0:-8]   #eliminate dtg at end of ugc string
        else:
            ugc_line = ugcString

        #print "ugc_line is ", ugc_line
        working_ugc_list = ugc_line.split('-')  #individual parts
        state = ''
        code_type = ''

        for ugc in working_ugc_list:
            try:
                # Case One (i.e., WIZ023)...
                if len(ugc) == 6:
                    state, code_type, decUGCs = self._ugcCaseOne(ugc)
                    for d in decUGCs:
                        ugc_list.append(d)

                # Case Two (i.e., 023)...
                elif len(ugc) == 3:
                    decUGCs = self._ugcCaseTwo(ugc, state, code_type)
                    for d in decUGCs:
                        ugc_list.append(d)

                # Case Three (ie. 044>067)
                elif len(ugc) == 7:
                    decUGCs = self._ugcCaseThree(ugc, state, code_type)
                    for d in decUGCs:
                        ugc_list.append(d)

                # Case Four (ie. WIZ044>067)
                elif len(ugc) == 10:
                    state, code_type, decUGCs = self._ugcCaseFour(ugc)
                    for d in decUGCs:
                        ugc_list.append(d)

                # Problem - malformed UGC
                else:
                    raise Exception, "Malformed UGC Found"

            except:
                LogStream.logProblem("Failure to decode UGC [" + ugc + \
                  "] in [" + ugc_line + "]", `self._lines`, LogStream.exc())
                raise Exception, "Failure to decode UGC"

        #print "ugc_list is ", ugc_list
        return ugc_list
开发者ID:KeithLatteri,项目名称:awips2,代码行数:51,代码来源:WarningDecoder.py

示例12: _usage

    def _usage(self):
        #Prints out usage information if started without sufficient command
        #line arguments.
        s =  """
usage: VTECDecoder -f productfilename -d -a activeTableName
-f productfilename:  location of the file to be decoded
-d:                  delete input file after processing flag
-g:                  Notify GFE when configured items arrive
-w: wmoid            WMOid for product, (optional, for info only)
-n:                  Do not make backups (optional)
-z: drtInfo          Run in DRT mode
"""
        print s
        LogStream.logProblem(s)
开发者ID:KeithLatteri,项目名称:awips2,代码行数:14,代码来源:WarningDecoder.py

示例13: process

def process(dbname):
    LogStream.logEvent("Purging all grids from: ", dbname)

    # get list of parms
    db = IFPDB(dbname)
    parms = db.getKeys()

    # cycle through each parm, get inventory, and store None grid to
    # remove the grids
    for p in range(0, parms.size()):
        we = db.getItem(str(parms.get(p)))
        inv = we.getKeys()
        for i in range(0, inv.size()):
            we.removeItem(inv.get(i))
开发者ID:KeithLatteri,项目名称:awips2,代码行数:14,代码来源:purgeAllGrids.py

示例14: _getOverviewText

    def _getOverviewText(self, startLine):
        #searches through the product from the startLine to the date-time 
        #group, then until the first UGC line.  Extracts out the text for 
        #the overview text (which is after the MND header.  Returns the 
        #overviewText.
        count = startLine
        ugcLine = None

        #search for the MND header date line
        while 1:
            dline_search = re.search(self._dlineRE, self._lines[count])
            count = count + 1
            if dline_search:
                break
            if count >= len(self._lines)-1:
                raise Exception, "No MND date line to start overview text"
        startOverviewLine = count  #next line after MND date line

        #search for the 1st UGC line 
        ugcRE = r'^[A-Z][A-Z][CZ][0-9][0-9][0-9].*'
        while 1:
            ugc_search = re.search(ugcRE, self._lines[count])
            if ugc_search:
                stopOverviewLine = count - 1
                break
            count = count + 1
            if count >= len(self._lines)-1:
                raise Exception, "No UGC line to end overview text"

        #now eliminate any blank lines between the start/stop overview line
        while startOverviewLine <= stopOverviewLine:
            if len(string.strip(self._lines[startOverviewLine])) != 0:
                break
            startOverviewLine = startOverviewLine + 1
        while startOverviewLine <= stopOverviewLine:
            if len(string.strip(self._lines[stopOverviewLine])) != 0:
                break
            stopOverviewLine = stopOverviewLine - 1

        LogStream.logDebug("start/stop overview: ", startOverviewLine, 
          stopOverviewLine)

        #put together the text
        if startOverviewLine <= stopOverviewLine:
            overviewLines = self._lines[startOverviewLine:stopOverviewLine+1]
            overviewText = string.join(overviewLines, '\n')
            return (overviewText, stopOverviewLine)
        else:
            return ("", startLine)
开发者ID:KeithLatteri,项目名称:awips2,代码行数:49,代码来源:WarningDecoder.py

示例15: _decodeCommandLine

    def _decodeCommandLine(self):
        #Routine to decode the command line.
        if self._command is None:
            self.command = sys.argv        

        if len(self._command) < 2:
            self._usage()
            sys.exit(1)

        LogStream.logVerbose("Command line: ", self._command[1:])

        try:
            optionlist, arglist = getopt.getopt(self._command[1:], 'f:da:gw:nz:')
        except getopt.error, val:
            LogStream.logProblem(val)
            self._usage()
            sys.exit(1)
开发者ID:KeithLatteri,项目名称:awips2,代码行数:17,代码来源:WarningDecoder.py


注:本文中的LogStream类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。