本文整理汇总了Python中socorro.lib.util.DotDict.product方法的典型用法代码示例。如果您正苦于以下问题:Python DotDict.product方法的具体用法?Python DotDict.product怎么用?Python DotDict.product使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类socorro.lib.util.DotDict
的用法示例。
在下文中一共展示了DotDict.product方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_no_crashing_thread
# 需要导入模块: from socorro.lib.util import DotDict [as 别名]
# 或者: from socorro.lib.util.DotDict import product [as 别名]
def test_no_crashing_thread(self, mocked_subprocess_module):
config = self.get_basic_config()
raw_crash = copy.copy(canonical_standard_raw_crash)
raw_dumps = {config.dump_field: 'a_fake_dump.dump'}
processed_crash = DotDict()
processed_crash.product = 'Firefox'
processed_crash.os_name = 'Windows NT'
processed_crash.cpu_name = 'x86'
processed_crash.signature = 'EnterBaseline'
processed_crash['json_dump'] = {} # note the empty json_dump
processor_meta = self.get_basic_processor_meta()
mocked_subprocess_handle = (
mocked_subprocess_module.Popen.return_value
)
mocked_subprocess_handle.stdout.read.return_value = (
'EXTRA-SPECIAL'
)
mocked_subprocess_handle.wait.return_value = 0
rule = JitCrashCategorizeRule(config)
# the call to be tested
res = rule._predicate(
raw_crash, raw_dumps, processed_crash, processor_meta
)
# Simply verify that no exception is raised.
ok_(res)
示例2: test_wrong_signature
# 需要导入模块: from socorro.lib.util import DotDict [as 别名]
# 或者: from socorro.lib.util.DotDict import product [as 别名]
def test_wrong_signature(self, mocked_subprocess_module):
config = self.get_basic_config()
raw_crash = copy.copy(canonical_standard_raw_crash)
raw_dumps = {config.dump_field: 'a_fake_dump.dump'}
processed_crash = DotDict()
processed_crash.product = 'Firefox'
processed_crash.os_name = 'Windows NT'
processed_crash.cpu_name = 'x86'
processed_crash.signature = 'this-is-not-a-JIT-signature'
processed_crash['json_dump.crashing_thread.frames'] = [
DotDict({'not_module': 'not-a-module',}),
DotDict({'module': 'a-module',})
]
processor_meta = self.get_basic_processor_meta()
mocked_subprocess_handle = (
mocked_subprocess_module.Popen.return_value
)
mocked_subprocess_handle.stdout.read.return_value = (
'EXTRA-SPECIAL'
)
mocked_subprocess_handle.wait.return_value = 0
rule = JitCrashCategorizeRule(config)
# the call to be tested
rule.act(raw_crash, raw_dumps, processed_crash, processor_meta)
ok_('classifications.jit.category' not in processed_crash)
ok_('classifications.jit.category_return_code' not in processed_crash)
示例3: _create_basic_processed_crash
# 需要导入模块: from socorro.lib.util import DotDict [as 别名]
# 或者: from socorro.lib.util.DotDict import product [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',
#.........这里部分代码省略.........