• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python reader.read函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: log_is_unstable

    def log_is_unstable(self, log_f):
        log_f.seek(0)

        statuses = defaultdict(set)

        def handle_status(item):
            if item["test"] == self.target:
                statuses[item["subtest"]].add(item["status"])

        def handle_end(item):
            if item["test"] == self.target:
                statuses[None].add(item["status"])

        reader.each_log(reader.read(log_f),
                        {"test_status": handle_status,
                         "test_end": handle_end})

        logger.debug(str(statuses))

        if not statuses:
            logger.error("Didn't get any useful output from wptrunner")
            log_f.seek(0)
            for item in reader.read(log_f):
                logger.debug(item)
            return None

        return any(len(item) > 1 for item in statuses.itervalues())
开发者ID:AlanWasTaken,项目名称:servo,代码行数:27,代码来源:reduce.py


示例2: test_handler

    def test_handler(self):
        data = [{"action": "action_0", "data": "data_0"},
                {"action": "action_1", "data": "data_1"}]

        f = self.to_file_like(data)

        test = self
        class ReaderTestHandler(reader.LogHandler):
            def __init__(self):
                self.action_0_count = 0
                self.action_1_count = 0

            def action_0(self, item):
                test.assertEquals(item["action"], "action_0")
                self.action_0_count += 1

            def action_1(self, item):
                test.assertEquals(item["action"], "action_1")
                self.action_1_count += 1

        handler = ReaderTestHandler()
        reader.handle_log(reader.read(f), handler)

        self.assertEquals(handler.action_0_count, 1)
        self.assertEquals(handler.action_1_count, 1)
开发者ID:mlasak,项目名称:gecko-dev,代码行数:25,代码来源:test_structured.py


示例3: process_test_job

def process_test_job(data):
    global logger
    logger = logger or structuredlog.get_default_logger()

    build_name = "{}-{} {}".format(data['platform'], data['buildtype'], data['test'])
    logger.debug("now processing a '{}' job".format(build_name))

    log_url = None
    for name, url in data['blobber_files'].iteritems():
        if name in settings['structured_log_names']:
            log_url = url
            break
    log_path = _download_log(log_url)

    try:
        backend = settings['datastore']
        db_args = config.database
        store = get_storage_backend(backend, **db_args)

        # TODO commit metadata about the test run

        handler = StoreResultsHandler(store)
        with open(log_path, 'r') as log:
            iterator = reader.read(log)
            reader.handle_log(iterator, handler)
    finally:
        mozfile.remove(log_path)
开发者ID:ahal,项目名称:structured-catalog,代码行数:27,代码来源:worker.py


示例4: to_json

def to_json(*log_files):
    handler = LogHandler()
    for f in log_files:
        reader.handle_log(reader.read(f),
                          handler)

    return handler.rv
开发者ID:jgraham,项目名称:wptreport,代码行数:7,代码来源:jsondata.py


示例5: get_statuses

def get_statuses(filenames):
    handler = StatusHandler()

    for filename in filenames:
        with open(filename) as f:
            reader.handle_log(reader.read(f), handler)

    return handler.statuses
开发者ID:AlanWasTaken,项目名称:servo,代码行数:8,代码来源:unstable.py


示例6: get_test_failures

def get_test_failures(raw_log):
    """
    Return the list of test failures contained within a structured log file.
    """
    failures = []
    def test_status(data):
        if data['status'] == 'FAIL':
            failures.append(data)
    with open(raw_log, 'r') as f:
        #XXX: bug 985606: map_action is a generator
        list(reader.map_action(reader.read(f),
                               {"test_status":test_status}))
    return failures
开发者ID:andreastt,项目名称:fxos-certsuite,代码行数:13,代码来源:harness.py


示例7: main

def main(**kwargs):
    if kwargs["output"] is None:
        output = sys.stdout
    else:
        output = open(kwargs["output"], "w")
    readers = [read(open(filename, 'r')) for filename in kwargs["files"]]
    start_events = [process_until_suite_start(reader, output) for reader in readers]
    validate_start_events(start_events)
    merged_start_event = merge_start_events(start_events)
    dump_entry(fill_process_info(merged_start_event), output)

    end_events = [process_until_suite_end(reader, output) for reader in readers]
    dump_entry(fill_process_info(end_events[0]), output)

    for reader in readers:
        for entry in reader:
            dump_entry(entry, output)
开发者ID:AlanWasTaken,项目名称:servo,代码行数:17,代码来源:logmerge.py


示例8: parse_log

    def parse_log(self):
        """
        Parse the entire log with ``mozlog``.

        This presumes that the log at ``log_url`` is a gzipped structured
        log generated by ``mozlog``.
        """
        handler = self.SummaryHandler()

        with self.get_log_handle(self.url) as in_f:
            try:
                reader.handle_log(reader.read(in_f), handler)
                self.artifact["errors_truncated"] = False
            except StopIteration:
                # cap out the number of lines we store in the artifact.
                self.artifact["errors_truncated"] = True

        self.artifact["all_errors"] = handler.lines
开发者ID:EricRahm,项目名称:treeherder,代码行数:18,代码来源:artifactbuilders.py


示例9: record_results

def record_results(*log_files):
    handler = LogHandler()

    products = []
    for name in log_files:
        product, filename = name.split(":", 1)
        products.append((product, filename))

    handler.set_products([item[0] for item in products])
    for product, logfile in products:
        handler.set_product(product)
        with open(logfile) as f:
            reader.handle_log(reader.read(f),
                              handler)

    data = handler.data

    data["results"] = data["results"].values()

    return data
开发者ID:jgraham,项目名称:wptreport,代码行数:20,代码来源:report.py


示例10: process_test_job

def process_test_job(data):
    global logger
    logger = logger or utils.get_logger(name='catalog-worker')

    build_name = "{}-{} {}".format(data['platform'], data['buildtype'], data['test'])
    logger.info("now processing a '{}' job".format(build_name))

    log_url = utils.get_structured_log(data['blobber_files'])
    log_path = _download_log(log_url)

    try:
        backend = settings['datastore']
        db_args = config.database
        store = get_storage_backend(backend, **db_args)

        # TODO commit metadata about the test run

        handler = StoreResultsHandler(store)
        with open(log_path, 'r') as log:
            iterator = reader.read(log)
            reader.handle_log(iterator, handler)
    finally:
        mozfile.remove(log_path)
开发者ID:mozilla,项目名称:structured-catalog,代码行数:23,代码来源:work.py


示例11: test_read

    def test_read(self):
        data = [{"action": "action_0", "data": "data_0"},
                {"action": "action_1", "data": "data_1"}]

        f = self.to_file_like(data)
        self.assertEquals(data, list(reader.read(f)))
开发者ID:mlasak,项目名称:gecko-dev,代码行数:6,代码来源:test_structured.py


示例12: update_from_log

 def update_from_log(self, log_file):
     self.run_info = None
     log_reader = reader.read(log_file)
     reader.each_log(log_reader, self.action_map)
开发者ID:L2-D2,项目名称:gecko-dev,代码行数:4,代码来源:metadata.py


示例13: parse_log

def parse_log(path):
    with open(path) as f:
        regression_handler = results.LogHandler()
        reader.handle_log(reader.read(f),
                          regression_handler)
        return regression_handler.results
开发者ID:JJTC-PX,项目名称:fxos-certsuite,代码行数:6,代码来源:__init__.py


示例14: worker_thread

def worker_thread(action_map, context):
    stream = DataStream(context)
    reader.each_log(reader.read(stream), action_map)
    stream.socket.close()
开发者ID:ahal,项目名称:corredor,代码行数:4,代码来源:handler.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python moznetwork.get_ip函数代码示例发布时间:2022-05-27
下一篇:
Python commandline.setup_logging函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap