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


Python logs.error函数代码示例

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


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

示例1: __get_status

    def __get_status(self, server, user, user_ip, req_id, start=0, count=100):
        try:
            (host, port) = server.split(':')
            port = int(port)

        except ValueError:
            logs.error("invalid server address in network XML: %s" % server)
            raise wsgicomm.WIInternalError, "invalid server address"

        try:
            arcl = Arclink()
            arcl.open_connection(host, port, user, user_ip=user_ip,
                timeout=self.status_timeout)

            try:
                #new version requires an arclink update to support pagination
                #status = arcl.get_status(req_id, start, count)
                status = arcl.get_status(req_id)
                status.request = status.request[:count]
                return status

            finally:
                arcl.close_connection()

        except (ArclinkError, socket.error) as e:
            raise wsgicomm.WIServiceError, str(e)
开发者ID:Fran89,项目名称:webdc3,代码行数:26,代码来源:request.py

示例2: parseDate

def parseDate(datestr):
    m = _rx_datetime.match(datestr)
    if not m:
        logs.error("invalid date: " + datestr)
        return (seiscomp3.Core.Time(1980, 1, 1, 0, 0, 0), "1980-01-01T00:00:00.0000Z")

    try:
        year = int(m.group("year"))
        (month, mday) = _dy2mdy(int(m.group("doy")), year)

        if m.group("hour"):
            hour = int(m.group("hour"))
            minute = int(m.group("minute"))
        else:
            hour = 0
            minute = 0

        if m.group("second"):
            second = int(m.group("second"))
        else:
            second = 0

        coretime = seiscomp3.Core.Time(year, month, mday, hour, minute, second)

    except (TypeError, ValueError, IndexError):
        logs.error("invalid date: " + datestr)
        return (seiscomp3.Core.Time(1980, 1, 1, 0, 0, 0), "1980-01-01T00:00:00.0000Z")

    return (coretime, coretime.toString("%Y-%m-%dT%H:%M:%S.%fZ"))
开发者ID:SeisComP3,项目名称:seiscomp3,代码行数:29,代码来源:key2inv.py

示例3: loadGains

def loadGains(fileName):
    try:
        fd = open(fileName)
        try:
            line = fd.readline()
            lineno = 0
            while line:
                line = line.strip()
                lineno += 1

                if not line or line[0] == '#':
                    line = fd.readline()
                    continue

                try:
                    (deviceName, deviceIdPattern, streamPattern, gain) = line.split()
                    if deviceName in gainTable:
                        gainTable[deviceName].append((streamPattern, deviceIdPattern,
                            float(gain)))
                    else:
                        gainTable[deviceName] = [ (streamPattern, deviceIdPattern,
                            float(gain)) ]

                except (TypeError, ValueError):
                    logs.error("%s:%d: parse error" % (fileName, lineno))
                    sys.exit(1)

                line = fd.readline()

        finally:
            fd.close()

    except IOError, e:
        logs.error("cannot open %s: %s" % (fileName, str(e)))
        sys.exit(1)
开发者ID:SeisComP3,项目名称:seiscomp3,代码行数:35,代码来源:key2inv.py

示例4: show_status

def show_status(request):
    try:
        logs.info(" datacenter name: " + request.dcname)
        rqstat = request.status()
    except ArclinkError, e:
        logs.error(str(e))
        return
开发者ID:smellyfis,项目名称:seiscomp3,代码行数:7,代码来源:arclink_fetch.py

示例5: scan_cha

    def scan_cha(d):
        last_file = {}

        for f in os.listdir(d):
            try:
                (net, sta, loc, cha, ext, year, doy) = f.split('.')
                nets.add((net, int(year)))

            except ValueError:
                logs.error("invalid SDS file:" + p, True)
                continue

            if (net, sta, loc, cha) not in timespan:
                continue

            try:
                if doy > last_file[loc][0]:
                    last_file[loc] = (doy, f)

            except KeyError:
                last_file[loc] = (doy, f)

        for (loc, (doy, f)) in last_file.items():
            with open(d + '/' + f, 'rb') as fd:
                nslc = tuple(f.split('.')[:4])
                rec = mseedlite.Record(fd)
                fd.seek(-rec.size, 2)
                rec = mseedlite.Record(fd)
                ts = timespan[nslc]

                if ts.start < rec.end_time < ts.end:
                    ts.start = rec.end_time

                elif rec.end_time >= ts.end:
                    del timespan[nslc]
开发者ID:Fran89,项目名称:seiscomp3,代码行数:35,代码来源:fdsnws2sds.py

示例6: parseOrientation

def parseOrientation(orientation):
    for x in orientation.split(';'):
        try:
            (code, azimuth, dip) = x.split()
            yield (code, float(azimuth), float(dip))
        except (TypeError, ValueError):
            logs.error("error parsing orientation %s at %s" % (orientation, x))
            continue
开发者ID:SeisComP3,项目名称:seiscomp3,代码行数:8,代码来源:key2inv.py

示例7: main

def main():
    (SSLpasswordDict, addr, request_format, data_format, label, resp_dict, rebuild_volume, proxymode, user, timeout, retries, output_file, input_file, spfr) = process_options()

    try:
        ret = _main(SSLpasswordDict, addr, request_format, data_format, label, resp_dict, rebuild_volume, proxymode, user, timeout, retries, output_file, input_file, spfr)

    except ArclinkError, e:
        logs.error(str(e))
        ret = 1
开发者ID:smellyfis,项目名称:seiscomp3,代码行数:9,代码来源:arclink_fetch.py

示例8: parse_breqfast_from_handler

def parse_breqfast_from_handler(req, fh):
    parser = BreqParser()
    parser.parse_email_from_handler(fh)
    req.content = parser.reqlist
    logs.debug("")
    if parser.failstr:
        logs.error(parser.failstr)
    else:
        logs.info("parsed %d lines from breqfast message" % len(req.content))
开发者ID:smellyfis,项目名称:seiscomp3,代码行数:9,代码来源:arclink_fetch.py

示例9: next

    def next(self):
        while True:
            try:
                return Record(self.__fd)

            except MSeedNoData:
                pass

            except MSeedError, e:
                logs.error(str(e))
开发者ID:Fran89,项目名称:seiscomp3,代码行数:10,代码来源:mseedlite.py

示例10: __parse_arglist

    def __parse_arglist(self, arglist):
        d = {}
        for arg in arglist:
            pv = arg.split('=', 1)
            if len(pv) != 2:
                logs.error("invalid request args in status: " + args)
                continue

            d[pv[0]] = pv[1]

        return d
开发者ID:Fran89,项目名称:webdc3,代码行数:11,代码来源:request.py

示例11: getConfigFloat

    def getConfigFloat(self, name, default = None):
        try:
            return float(self.__cfg.getString(name))

        except ValueError:
            logs.error("config parameter '%s' has invalid value" % name)
            return default

        #except seiscomp3.Config.OptionNotFoundException:
        except Exception, e:
            return default
开发者ID:Fran89,项目名称:webdc3,代码行数:11,代码来源:webinterface.py

示例12: parse_native_from_handler

def parse_native_from_handler(req, fd):
    rqline = fd.readline()
    while rqline:
        rqline = rqline.strip()
        if not rqline:
            rqline = fd.readline()
            logs.debug("skipping empty request line")
            continue
            
        rqsplit = rqline.split()
        if len(rqsplit) < 3:
            logs.error("invalid request line: '%s'" % (rqline,))
            rqline = fd.readline()
            continue

        try:
            start_time = datetime.datetime(*map(int, rqsplit[0].split(",")))
            end_time = datetime.datetime(*map(int, rqsplit[1].split(",")))
        except ValueError, e:
            logs.error("syntax error (%s): '%s'" % (str(e), rqline))
            rqline = fd.readline()
            continue

        network = rqsplit[2]
        station = "."
        channel = "."
        location = "."

        i = 3
        if len(rqsplit) > 3 and rqsplit[3] != ".":
            station = rqsplit[3]
            i += 1
            if len(rqsplit) > 4 and rqsplit[4] != ".":
                channel = rqsplit[4]
                i += 1
                if len(rqsplit) > 5 and rqsplit[5] != ".":
                    location = rqsplit[5]
                    i += 1
                    
        while len(rqsplit) > i and rqsplit[i] == ".":
            i += 1
        
        constraints = {}
        for arg in rqsplit[i:]:
            pv = arg.split('=', 1)
            if len(pv) != 2:
                raise ArclinkError, "invalid request syntax"
            
            constraints[pv[0]] = pv[1]

        req.add(network, station, channel, location, start_time, end_time,
            constraints)
        
        rqline = fd.readline()
开发者ID:smellyfis,项目名称:seiscomp3,代码行数:54,代码来源:arclink_fetch.py

示例13: request_purge

    def request_purge(self, envir, params):
        """Delete one user request at a given server.

        Input:  server          server DCID
                user            user ID
                request         request ID

        Output: true

        """
        dcid = params.get("server")
        user = params.get("user")
        req_id = params.get("request")

        if dcid is None:
            raise wsgicomm.WIClientError, "missing server"

        else:
            try:
                server = self.nodes[dcid]['address']

            except KeyError:
                raise wsgicomm.WIClientError, "invalid server"

        if user is None:
            raise wsgicomm.WIClientError, "missing user ID"

        if req_id is None:
            raise wsgicomm.WIClientError, "missing request ID"

        try:
            (host, port) = server.split(':')
            port = int(port)

        except ValueError:
            logs.error("invalid server address in network XML: %s" % server)
            raise wsgicomm.WIInternalError, "invalid server address"

        try:
            arcl = Arclink()
            arcl.open_connection(host, port, user)

        except (ArclinkError, socket.error) as e:
            raise wsgicomm.WIServiceError, str(e)

        try:
            arcl.purge(req_id)
            return json.dumps(True)

        except (ArclinkError, socket.error) as e:
            arcl.close_connection()
            raise wsgicomm.WIServiceError, str(e)
开发者ID:Fran89,项目名称:webdc3,代码行数:52,代码来源:request.py

示例14: log_print

    def log_print(s):
        if logstream:
            logstream.write(s + "\n")

        else:
            try:
                fh = file(fname, "a")
                try:
                    fh.write(s + "\n")
                finally:
                    fh.close()
            except OSError:
                logs.error("Log file %s could not be opened!" % fname)
开发者ID:libpcap,项目名称:seiscomp3,代码行数:13,代码来源:breqfast.py

示例15: parsePkgstr

def parsePkgstr(pkgstr):
    result = {}
    for x in pkgstr.split():
        m = _rx_pkg.match(x)
        if not m:
            logs.error("error parsing %s at %s" % (pkgstr, x))
            continue

        result[m.group('pkg')] = m.group('profile')

    if 'trunk' not in result:
        result['trunk'] = None

    return result
开发者ID:SeisComP3,项目名称:seiscomp3,代码行数:14,代码来源:key2inv.py


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