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


Python DotDict.success方法代码示例

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


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

示例1: _execute_external_process

# 需要导入模块: from socorro.lib.util import DotDict [as 别名]
# 或者: from socorro.lib.util.DotDict import success [as 别名]
    def _execute_external_process(self, command_line, processor_meta):
        stackwalker_output, return_code = super(BreakpadStackwalkerRule2015, self)._execute_external_process(
            command_line, processor_meta
        )

        if not isinstance(stackwalker_output, Mapping):
            processor_meta.processor_notes.append(
                "MDSW produced unexpected output: %s..." % str(stackwalker_output)[:10]
            )
            stackwalker_output = {}

        stackwalker_data = DotDict()
        stackwalker_data.json_dump = stackwalker_output
        stackwalker_data.mdsw_return_code = return_code

        stackwalker_data.mdsw_status_string = stackwalker_output.get("status", "unknown error")
        stackwalker_data.success = stackwalker_data.mdsw_status_string == "OK"

        if return_code == 124:
            processor_meta.processor_notes.append("MDSW terminated with SIGKILL due to timeout")
        elif return_code != 0 or not stackwalker_data.success:
            processor_meta.processor_notes.append(
                "MDSW failed on '%s': %s" % (command_line, stackwalker_data.mdsw_status_string)
            )

        return stackwalker_data, return_code
开发者ID:rhelmer,项目名称:socorro,代码行数:28,代码来源:breakpad_transform_rules.py

示例2: convert_raw_crash_to_processed_crash

# 需要导入模块: from socorro.lib.util import DotDict [as 别名]
# 或者: from socorro.lib.util.DotDict import success [as 别名]
    def convert_raw_crash_to_processed_crash(self, raw_crash, raw_dumps):
        """Take a raw_crash and its associated raw_dumps and return a
        processed_crash.
        """
        # processor_meta_data will be used to ferry "inside information" to
        # transformation rules.  Sometimes rules need a bit more extra
        # information about the transformation process itself.
        processor_meta_data = DotDict()
        processor_meta_data.processor_notes = [
            self.config.processor_name,
            self.__class__.__name__
        ]
        processor_meta_data.quit_check = self.quit_check
        processor_meta_data.processor = self

        # create the empty processed crash
        processed_crash = DotDict()
        processed_crash.success = False
        processed_crash.started_datetime = utc_now()
        # for backwards compatibility:
        processed_crash.startedDateTime = processed_crash.started_datetime
        processed_crash.signature = 'EMPTY: crash failed to process'

        crash_id = raw_crash.get('uuid', 'unknown')
        try:
            # quit_check calls ought to be scattered around the code to allow
            # the processor to be responsive to requests to shut down.
            self.quit_check()

            processor_meta_data.started_timestamp = self._log_job_start(
                crash_id
            )

            # apply transformations
            #    step through each of the rule sets to apply the rules.
            for a_rule_set in self.rule_system:
                # for each rule set, invoke the 'act' method - this method
                # will be the method specified in fourth element of the
                # rule set configuration list.
                a_rule_set.act(
                    raw_crash,
                    raw_dumps,
                    processed_crash,
                    processor_meta_data
                )
                self.quit_check()

            # the crash made it through the processor rules with no exceptions
            # raised, call it a success.
            processed_crash.success = True

        except Exception, x:
            self.config.logger.warning(
                'Error while processing %s: %s',
                crash_id,
                str(x),
                exc_info=True
            )
            processor_meta_data.processor_notes.append(
                'unrecoverable processor error: %s' % x
            )
开发者ID:jberkus,项目名称:socorro,代码行数:63,代码来源:processor_2015.py

示例3: test_action_predicate_accept

# 需要导入模块: from socorro.lib.util import DotDict [as 别名]
# 或者: from socorro.lib.util.DotDict import success [as 别名]

#.........这里部分代码省略.........
        test_raw_crash.PluginHang = "1"
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = "19"
        test_raw_crash.BuildID = "20121031"
        test_processed_crash = DotDict()
        test_processed_crash.dump = "fake dump"
        test_processed_crash.json_dump = DotDict()
        ok_(filter_rule.predicate(test_raw_crash, test_processed_crash, fake_processor))

        # find crashes with amd64 architecture info
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = "1"
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = "19"
        test_raw_crash.BuildID = "20121031"
        test_processed_crash = DotDict()
        test_processed_crash.dump = "fake dump"
        test_processed_crash.json_dump = DotDict()
        test_processed_crash.json_dump.system_info = DotDict()
        test_processed_crash.json_dump.cpu_arch = "amd64"
        ok_(filter_rule.predicate(test_raw_crash, test_processed_crash, fake_processor))

        # find crashes with main dump processing errors
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = "1"
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = "19"
        test_raw_crash.BuildID = "20121031"
        test_processed_crash = DotDict()
        test_processed_crash.dump = "fake dump"
        test_processed_crash.json_dump = DotDict()
        test_processed_crash.json_dump.system_info = DotDict()
        test_processed_crash.json_dump.system_info.cpu_arch = "x86"
        test_processed_crash.success = False
        ok_(filter_rule.predicate(test_raw_crash, test_processed_crash, fake_processor))

        # find crashes with extra dump processing errors
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = "1"
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = "19"
        test_raw_crash.BuildID = "20121031"
        test_processed_crash = DotDict()
        test_processed_crash.dump = "fake dump"
        test_processed_crash.json_dump = DotDict()
        test_processed_crash.json_dump.system_info = DotDict()
        test_processed_crash.json_dump.system_info.cpu_arch = "x86"
        test_processed_crash.success = True
        test_processed_crash.additional_minidumps = ["a", "b", "c"]
        test_processed_crash.a = DotDict()
        test_processed_crash.a.success = True
        test_processed_crash.b = DotDict()
        test_processed_crash.b.success = True
        test_processed_crash.c = DotDict()
        test_processed_crash.c.success = False
        ok_(filter_rule.predicate(test_raw_crash, test_processed_crash, fake_processor))

        # find crashes with missing critical attribute
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = "1"
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = "19"
        test_raw_crash.BuildID = "20121031"
        test_processed_crash = DotDict()
        test_processed_crash.dump = "fake dump"
        test_processed_crash.json_dump = DotDict()
开发者ID:JamJar,项目名称:socorro,代码行数:70,代码来源:test_skunk_classifiers.py

示例4: _analyze_header

# 需要导入模块: from socorro.lib.util import DotDict [as 别名]
# 或者: from socorro.lib.util.DotDict import success [as 别名]
    def _analyze_header(self, crash_id, dump_analysis_line_iterator,
                        submitted_timestamp, processor_notes):
        """ Scan through the lines of the dump header:
            - extract data to update the record for this crash in 'reports',
              including the id of the crashing thread
            Returns: Dictionary of the various values that were updated in
                     the database
            Input parameters:
            - dump_analysis_line_iterator - an iterator object that feeds lines
                                            from crash dump data
            - submitted_timestamp
            - processor_notes
        """
        crashed_thread = None
        processed_crash_update = DotDict()
        # minimal update requirements
        processed_crash_update.success = True
        processed_crash_update.os_name = None
        processed_crash_update.os_version = None
        processed_crash_update.cpu_name = None
        processed_crash_update.cpu_info = None
        processed_crash_update.reason = None
        processed_crash_update.address = None

        header_lines_were_found = False
        flash_version = None
        for line in dump_analysis_line_iterator:
            line = line.strip()
            # empty line separates header data from thread data
            if line == '':
                break
            header_lines_were_found = True
            values = map(lambda x: x.strip(), line.split('|'))
            if len(values) < 3:
                processor_notes.append('Cannot parse header line "%s"'
                                       % line)
                continue
            values = map(emptyFilter, values)
            if values[0] == 'OS':
                name = self._truncate_or_none(values[1], 100)
                version = self._truncate_or_none(values[2], 100)
                processed_crash_update.os_name = name
                processed_crash_update.os_version = version
            elif values[0] == 'CPU':
                processed_crash_update.cpu_name = \
                    self._truncate_or_none(values[1], 100)
                processed_crash_update.cpu_info = \
                    self._truncate_or_none(values[2], 100)
                try:
                    processed_crash_update.cpu_info = ('%s | %s' % (
                      processed_crash_update.cpu_info,
                      self._get_truncate_or_none(values[3], 100)
                    ))
                except IndexError:
                    pass
            elif values[0] == 'Crash':
                processed_crash_update.reason = \
                    self._truncate_or_none(values[1], 255)
                try:
                    processed_crash_update.address = \
                        self._truncate_or_none(values[2], 20)
                except IndexError:
                    processed_crash_update.address = None
                try:
                    crashed_thread = int(values[3])
                except Exception:
                    crashed_thread = None
            elif values[0] == 'Module':
                # grab only the flash version, which is not quite as easy as
                # it looks
                if not flash_version:
                    flash_version = self._get_flash_version(values)
        if not header_lines_were_found:
            message = "%s returned no header lines for crash_id: %s" % \
                (self.config.minidump_stackwalk_pathname, crash_id)
            processor_notes.append(message)
            #self.config.logger.warning("%s", message)

        if crashed_thread is None:
            message = "No thread was identified as the cause of the crash"
            processor_notes.append(message)
            self.config.logger.info("%s", message)
        processed_crash_update.crashedThread = crashed_thread
        if not flash_version:
            flash_version = '[blank]'
        processed_crash_update.flash_version = flash_version
        #self.config.logger.debug(
        #  " updated values  %s",
        #  processed_crash_update
        #)
        return processed_crash_update
开发者ID:ariaBennett,项目名称:socorro,代码行数:93,代码来源:legacy_processor.py

示例5: _create_basic_processed_crash

# 需要导入模块: from socorro.lib.util import DotDict [as 别名]
# 或者: from socorro.lib.util.DotDict import success [as 别名]
    def _create_basic_processed_crash(self,
                                      uuid,
                                      raw_crash,
                                      submitted_timestamp,
                                      started_timestamp,
                                      processor_notes):
        """
        This function is run only by a worker thread.
          Create the record for the current job in the 'reports' table
          input parameters:
            uuid: the unique id identifying the job - corresponds with the
                  uuid column in the 'jobs' and the 'reports' tables
            jsonDocument: an object with a dictionary interface for fetching
                          the components of the json document
            submitted_timestamp: when job came in (a key used in partitioning)
            processor_notes: list of strings of error messages
        """
        #logger.debug("starting insertReportIntoDatabase")
        processed_crash = DotDict()
        processed_crash.success = False
        processed_crash.uuid = uuid
        processed_crash.startedDateTime = started_timestamp
        processed_crash.product = self._get_truncate_or_warn(
            raw_crash,
            'ProductName',
            processor_notes,
            None,
            30
        )
        processed_crash.version = self._get_truncate_or_warn(
            raw_crash,
            'Version',
            processor_notes,
            None,
            16
        )
        processed_crash.build = self._get_truncate_or_warn(
            raw_crash,
            'BuildID',
            processor_notes,
            None,
            16
        )
        processed_crash.url = self._get_truncate_or_none(
            raw_crash,
            'URL',
            255
        )
        processed_crash.user_comments = self._get_truncate_or_none(
            raw_crash,
            'Comments',
            500
        )
        processed_crash.app_notes = self._get_truncate_or_none(
            raw_crash,
            'Notes',
            1000
        )
        processed_crash.distributor = self._get_truncate_or_none(
            raw_crash,
            'Distributor',
            20
        )
        processed_crash.distributor_version = self._get_truncate_or_none(
            raw_crash,
            'Distributor_version',
            20
        )
        processed_crash.email = self._get_truncate_or_none(
            raw_crash,
            'Email',
            100
        )
        processed_crash.process_type = self._get_truncate_or_none(
            raw_crash,
            'ProcessType',
            10
        )
        processed_crash.release_channel = raw_crash.get(
            'ReleaseChannel',
            'unknown'
        )
        # userId is now deprecated and replace with empty string
        processed_crash.user_id = ""

        # ++++++++++++++++++++
        # date transformations
        processed_crash.date_processed = submitted_timestamp

        # defaultCrashTime: must have crashed before date processed
        submitted_timestamp_as_epoch = int(
            time.mktime(submitted_timestamp.timetuple())
        )
        timestampTime = int(
            raw_crash.get('timestamp', submitted_timestamp_as_epoch)
            )  # the old name for crash time
        crash_time = int(
            self._get_truncate_or_warn(
                raw_crash,
                'CrashTime',
#.........这里部分代码省略.........
开发者ID:ariaBennett,项目名称:socorro,代码行数:103,代码来源:legacy_processor.py

示例6: convert_raw_crash_to_processed_crash

# 需要导入模块: from socorro.lib.util import DotDict [as 别名]
# 或者: from socorro.lib.util.DotDict import success [as 别名]
    def convert_raw_crash_to_processed_crash(self, raw_crash, raw_dump):
        """ This function is run only by a worker thread.
            Given a job, fetch a thread local database connection and the json
            document.  Use these to create the record in the 'reports' table,
            then start the analysis of the dump file.

            input parameters:
        """
        try:
            self.quit_check()
            crash_id = raw_crash.uuid
            processor_notes = []
            processed_crash = DotDict()
            processed_crash.uuid = raw_crash.uuid
            processed_crash.success = False

            started_timestamp = self._log_job_start(crash_id)

            #self.config.logger.debug('about to apply rules')
            self.raw_crash_transform_rule_system.apply_all_rules(raw_crash,
                                                                 self)
            #self.config.logger.debug('done applying transform rules')

            try:
                submitted_timestamp = datetimeFromISOdateString(
                    raw_crash.submitted_timestamp
                )
            except KeyError:
                submitted_timestamp = dateFromOoid(crash_id)

            # formerly the call to 'insertReportIntoDatabase'
            processed_crash_update = self._create_basic_processed_crash(
                crash_id,
                raw_crash,
                submitted_timestamp,
                started_timestamp,
                processor_notes
            )
            processed_crash.update(processed_crash_update)

            temp_dump_pathname = self._get_temp_dump_pathname(
                crash_id,
                raw_dump
            )
            try:
                #logger.debug('about to doBreakpadStackDumpAnalysis')
                processed_crash_update_dict = \
                    self._do_breakpad_stack_dump_analysis(
                        crash_id,
                        temp_dump_pathname,
                        processed_crash.hang_type,
                        processed_crash.java_stack_trace,
                        submitted_timestamp,
                        processor_notes
                    )
                processed_crash.update(processed_crash_update_dict)
            finally:
                self._cleanup_temp_file(temp_dump_pathname)

            processed_crash.topmost_filenames = "|".join(
                processed_crash.get('topmost_filenames', [])
            )
            try:
                processed_crash.Winsock_LSP = raw_crash.Winsock_LSP
            except KeyError:
                pass  # if it's not in the original raw_crash,
                        # it does get into the jsonz

        #except (KeyboardInterrupt, SystemExit):
            #self.config.logger.info("quit request detected")
            #raise
        except Exception, x:
            self.config.logger.warning(
                'Error while processing %s: %s',
                crash_id,
                str(x),
                exc_info=True
            )
            processor_notes.append(str(x))
开发者ID:ariaBennett,项目名称:socorro,代码行数:81,代码来源:legacy_processor.py

示例7: test_action_predicate_accept

# 需要导入模块: from socorro.lib.util import DotDict [as 别名]
# 或者: from socorro.lib.util.DotDict import success [as 别名]

#.........这里部分代码省略.........
            test_processed_crash,
            fake_processor
        ))

        # find crashes with amd64 architecture info
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = '19'
        test_raw_crash.BuildID = '20121031'
        test_processed_crash = DotDict()
        test_processed_crash.dump = 'fake dump'
        test_processed_crash.json_dump = DotDict()
        test_processed_crash.json_dump.system_info = DotDict()
        test_processed_crash.json_dump.cpu_arch = 'amd64'
        ok_(filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            test_processed_crash,
            fake_processor
        ))

        # find crashes with main dump processing errors
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = '19'
        test_raw_crash.BuildID = '20121031'
        test_processed_crash = DotDict()
        test_processed_crash.dump = 'fake dump'
        test_processed_crash.json_dump = DotDict()
        test_processed_crash.json_dump.system_info = DotDict()
        test_processed_crash.json_dump.system_info.cpu_arch = 'x86'
        test_processed_crash.success = False
        ok_(filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            test_processed_crash,
            fake_processor
        ))

        # find crashes with extra dump processing errors
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = '19'
        test_raw_crash.BuildID = '20121031'
        test_processed_crash = DotDict()
        test_processed_crash.dump = 'fake dump'
        test_processed_crash.json_dump = DotDict()
        test_processed_crash.json_dump.system_info = DotDict()
        test_processed_crash.json_dump.system_info.cpu_arch = 'x86'
        test_processed_crash.success = True
        test_processed_crash.additional_minidumps = ['a', 'b', 'c']
        test_processed_crash.a = DotDict()
        test_processed_crash.a.success = True
        test_processed_crash.b = DotDict()
        test_processed_crash.b.success = True
        test_processed_crash.c = DotDict()
        test_processed_crash.c.success = False
        ok_(filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            test_processed_crash,
            fake_processor
        ))
开发者ID:Krispy2009,项目名称:socorro,代码行数:70,代码来源:test_skunk_classifiers.py


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