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


Python LogStream.logProblem方法代码示例

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


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

示例1: purgeOldSavedTables

# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logProblem [as 别名]
    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,代码行数:29,代码来源:VTECTableUtil.py

示例2: __init__

# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logProblem [as 别名]
    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,代码行数:37,代码来源:PngWriter.py

示例3: main

# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logProblem [as 别名]
def main():
    LogStream.logEvent("setupTextEA Starting")

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

示例4: executeFromJava

# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logProblem [as 别名]
def executeFromJava(databaseID):
    LogStream.logEvent("PurgeAllGrids starting")
    try:
        process(databaseID)
        LogStream.logEvent("PurgeAllGrids finished")
        sys.exit(0)
    except SystemExit:
        pass
    except:
        LogStream.logProblem("Caught exception\n", LogStream.exc())
开发者ID:KeithLatteri,项目名称:awips2,代码行数:12,代码来源:purgeAllGrids.py

示例5: decodeTimeString

# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logProblem [as 别名]
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,代码行数:12,代码来源:PngWriter.py

示例6: initParms

# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logProblem [as 别名]
    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,代码行数:56,代码来源:PngWriter.py

示例7: _expandUGC

# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logProblem [as 别名]
    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,代码行数:53,代码来源:WarningDecoder.py

示例8: _usage

# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logProblem [as 别名]
    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,代码行数:16,代码来源:WarningDecoder.py

示例9: _decodeCommandLine

# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logProblem [as 别名]
    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,代码行数:19,代码来源:WarningDecoder.py

示例10: getRealTimeZone

# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logProblem [as 别名]
def getRealTimeZone(tzstring):
    d = {'M':"MST7MDT",'m':"MST7",'V':'America/Puerto_Rico',
         'E':"EST5EDT",'e':"EST5",
         'C':"CST6CDT",'P':"PST8PDT",'A':"America/Anchorage",
         'H':"Pacific/Honolulu",'G':"Pacific/Guam", 
         'J':"Pacific/Palu", 'K': "Pacific/Wake", 'F': "Pacific/Ponape"}
    tzones = []
    for tz in tzstring:
        if d.has_key(tz):
            tzones.append(d[tz])

    if len(tzones) > 1:
        return tzones
    elif len(tzones) == 1:
        return tzones[0]
    else:
        LogStream.logProblem("No time zone information decodable: ", tzstring)
        return None
开发者ID:KeithLatteri,项目名称:awips2,代码行数:20,代码来源:createAreaDictionary.py

示例11: saveOldActiveTable

# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logProblem [as 别名]
    def saveOldActiveTable(self, oldActiveTable):
        #saves off the specified table and time stamps it

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

        #determine filename
        directory = os.path.join(os.path.dirname(self._activeTableFilename), "backup")
        try:
            os.makedirs(directory)
        except OSError as e:
            if e.errno != errno.EEXIST:
                LogStream.logProblem("Could not create active table backup directory:", 
                  directory, LogStream.exc())
                raise e
        
        gmtime = time.gmtime(time.time())
        format = "%Y%m%d_%H%M%S"
        baseN = os.path.basename(self._activeTableFilename)
        fn = time.strftime(format, gmtime) + "_" + baseN
        filename = os.path.join(directory, fn + ".gz")
        
        t = time.time()
        try:
            os.chmod(filename, 0666)
            os.remove(filename)
        except:
            pass

        #output file
        #gzip it to save space
        with gzip.GzipFile(filename, 'wb', 9) as fd:
            buf = cPickle.dumps(oldActiveTable)
            fd.write(buf)
        os.chmod(filename, 0664)
        
        t1 = time.time()
        tstr = "%.3f" % (t1-t)
        LogStream.logVerbose("Saved Previous Active Table: ", fn, "t=",
          tstr, "sec.")
开发者ID:KeithLatteri,项目名称:awips2,代码行数:42,代码来源:VTECTableUtil.py

示例12: main

# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logProblem [as 别名]
def main():
    LogStream.logEvent("ifpIMAGE Starting")
    
    DEFAULT_OUTPUT_DIR = '../products/IMAGE'

    #import siteConfig
    config = 'gfeConfig'
    userNameOption = 'SITE'
    #outDir = siteConfig.GFESUITE_PRDDIR + "/IMAGE"
    outDir = DEFAULT_OUTPUT_DIR
    tr = TimeRange.allTimes()
    startTime = tr.startTime()
    baseTime = None
    endTime = tr.endTime()
    usrTimeName = None    

    #port = int(siteConfig.GFESUITE_PORT)
    try:
        optlist, oargs = getopt.getopt(sys.argv[1:], "c:u:h:p:o:b:s:e:t:")
        for opt in optlist:
            if opt[0] == '-c':
                config = opt[1]
            elif opt[0] == '-u':
                userNameOption = opt[1]
            elif opt[0] == '-o':
                outDir = opt[1]
            elif opt[0] == '-s':
                startTime = decodeTimeString(opt[1])
            elif opt[0] == '-e':
                endTime = decodeTimeString(opt[1])
            elif opt[0] == '-t':
                usrTimeName = opt[1]
            elif opt[0] == '-b':
                baseTime = decodeTimeString(opt[1])

    except getopt.GetoptError, e:
        LogStream.logProblem(e)
        usage()
        raise SyntaxError, "Bad command line argument specified"
开发者ID:KeithLatteri,项目名称:awips2,代码行数:41,代码来源:PngWriter.py

示例13: _getProduct

# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logProblem [as 别名]
    def _getProduct(self, text=None, checkForWmo=False):        
        #Opens, reads the product. Splits into lines, strips whitespace,
        if text is None:
            fd = open(self._incomingFilename, 'r')
            if fd == -1:
                s = "Unable to open incoming file: " + self._incomingFilename
                LogStream.logProblem(s)
                raise Exception, s
            buf = fd.read()
            fd.close()
        else:
            buf = text
            
        raw = buf
        
        if checkForWmo:
            wmore = r'(\w{6} (\w{4}) (\d{6})(?: \w{3})?)'
            wmosearch = re.search(wmore, buf)
            if wmosearch:
                self._officeFromWMO = wmosearch.group(2)
                self._wmoid = wmosearch.group(1)

        #eliminate junk characters and change some
        if self._wmoid is not None:
            index = string.find(buf, self._wmoid)
            if index != -1:
                buf = buf[index:]   #remove garbage before start of real prod
        buf = re.sub(r",", r"...", buf)   #eliminate commas, replace with ...
        buf = re.sub(r"\.\.\. r", "...", buf)  #'... ' becomes '...'
        buf = re.sub(r"\r", r"", buf)   #eliminate carriage returns

        #LogStream.logVerbose("Product:\n", buf)

        #process the file into lines, eliminate trailing whitespace
        lines = string.split(buf, '\n')
        for n in xrange(len(lines)):
            lines[n] = string.rstrip(lines[n])

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

示例14: _getPilAndDTG

# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logProblem [as 别名]
    def _getPilAndDTG(self):
        #searches through the product (lines) and extracts out the product
        #pil and date-time group. Returns (pil, issueTime, lineEnd, fullpil).
        # The line end is how far the processing got for the PIL line.
        count = 0
        while 1:
            dtg_search = re.search(r' ([0123][0-9][012][0-9][0-5][0-9])',
              self._lines[count])
            pil_search = re.search(r'^([A-Z]{3})(\w{3}|\w{2}|\w{1})',
              self._lines[count+1])

            if dtg_search and pil_search:
                LogStream.logVerbose("Dtg=", dtg_search.group(0))
                LogStream.logVerbose("Pil=", pil_search.group(0))
                return (self._lines[count+1][0:3],
                  self._dtgFromDDHHMM(dtg_search.group(1)), count+2,
                    pil_search.group(0))
            count = count + 1
            if count >= len(self._lines)-1:
                LogStream.logProblem("Did not find either the product DTG" +\
                  " or the pil: ", string.join(self._lines, sep='\n'),
                  LogStream.exc())
                raise Exception, "Product DTG or Pil missing"
开发者ID:KeithLatteri,项目名称:awips2,代码行数:25,代码来源:WarningDecoder.py

示例15: usage

# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logProblem [as 别名]
def usage():
    msg = """
    usage: ifpIMAGE [-c config] [-u username] [-server serverURL] [-site siteID] -o directory
      [-b baseTime] [-s startTime] [-e endTime] [-t usrTimeRng]

         config   : Name of GFE style config file to use.
         directory: Where you wan't the png files written to.
         username : The name of the user (for config file lookup).
         baseTime : Output filenames are relative to baseTime. Basetime
                    format is yyyymmdd_hhmm.
         serverURL: The URL of the Thrift service, example: ec:9581/services
         siteID   : The site ID to localize as.
         startTime: starting time for images in format yyyymmdd_hhmm
         endTime  : ending time for images in format yyyymmdd_hhmm\n\n
         usrTimeRng: used to specify a user selected time range (e.g., "Day_3")
                    'usrTimeRng' overrides the start/endTime switches.
         drtTime  : The GFE may be started in the displaced real time mode.
                    The format of this entry is yyyymmdd_hhmm.
"""


    LogStream.logProblem(msg)
    sys.stderr.write(msg)
开发者ID:KeithLatteri,项目名称:awips2,代码行数:25,代码来源:PngWriter.py


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