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


Python LegacyCrashProcessor._log_job_start方法代码示例

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


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

示例1: test_convert_raw_crash_to_processed_crash_unexpected_error

# 需要导入模块: from socorro.processor.legacy_processor import LegacyCrashProcessor [as 别名]
# 或者: from socorro.processor.legacy_processor.LegacyCrashProcessor import _log_job_start [as 别名]
    def test_convert_raw_crash_to_processed_crash_unexpected_error(self):
        config = setup_config_with_mocks()
        mocked_transform_rules_str = "socorro.processor.legacy_processor.TransformRuleSystem"
        with mock.patch(mocked_transform_rules_str) as m_transform_class:
            m_transform = mock.Mock()
            m_transform_class.return_value = m_transform
            m_transform.attach_mock(mock.Mock(), "apply_all_rules")
            utc_now_str = "socorro.processor.legacy_processor.utc_now"
            with mock.patch(utc_now_str) as m_utc_now:
                m_utc_now.return_value = datetime(2012, 5, 4, 15, 11, tzinfo=UTC)

                raw_crash = DotDict()
                raw_crash.uuid = "3bc4bcaa-b61d-4d1f-85ae-30cb32120504"
                raw_crash.submitted_timestamp = "2012-05-04T15:33:33"
                raw_dump = {"upload_file_minidump": "abcdef"}

                leg_proc = LegacyCrashProcessor(config, config.mock_quit_fn)

                started_timestamp = datetime(2012, 5, 4, 15, 10, tzinfo=UTC)
                leg_proc._log_job_start = mock.Mock(return_value=started_timestamp)

                basic_processed_crash = DotDict()
                basic_processed_crash.uuid = raw_crash.uuid
                basic_processed_crash.success = False
                basic_processed_crash.hang_type = 0
                basic_processed_crash.java_stack_trace = None
                leg_proc._create_basic_processed_crash = mock.Mock(return_value=basic_processed_crash)

                leg_proc._get_temp_dump_pathname = mock.Mock(return_value="/tmp/x")

                leg_proc._log_job_end = mock.Mock()

                processed_crash_update_dict = DotDict()
                processed_crash_update_dict.success = True
                leg_proc._do_breakpad_stack_dump_analysis = mock.Mock(
                    side_effect=Exception("nobody expects the spanish " "inquisition")
                )

                # Here's the call being tested
                processed_crash = leg_proc.convert_raw_crash_to_processed_crash(raw_crash, raw_dump)

                self.assertEqual(1, leg_proc._log_job_end.call_count)
                leg_proc._log_job_end.assert_called_with(
                    datetime(2012, 5, 4, 15, 11, tzinfo=UTC), False, raw_crash.uuid
                )

                e = {
                    "processor_notes": "testing_processor:2012; unrecoverable " "processor error",
                    "completeddatetime": datetime(2012, 5, 4, 15, 11, tzinfo=UTC),
                    "success": False,
                    "uuid": raw_crash.uuid,
                    "hang_type": 0,
                    "java_stack_trace": None,
                    "additional_minidumps": [],
                }
                self.assertEqual(e, processed_crash)
                leg_proc._statistics.assert_has_calls(
                    [mock.call.incr("jobs"), mock.call.incr("restarts"), mock.call.incr("errors")], any_order=True
                )
开发者ID:erikrose,项目名称:socorro,代码行数:61,代码来源:test_legacy_processor.py

示例2: test_process_crash_unexpected_error

# 需要导入模块: from socorro.processor.legacy_processor import LegacyCrashProcessor [as 别名]
# 或者: from socorro.processor.legacy_processor.LegacyCrashProcessor import _log_job_start [as 别名]
    def test_process_crash_unexpected_error(self):
        config = setup_config_with_mocks()
        mocked_transform_rules_str = \
            'socorro.processor.legacy_processor.TransformRuleSystem'
        with mock.patch(mocked_transform_rules_str) as m_transform_class:
            m_transform = mock.Mock()
            m_transform_class.return_value = m_transform
            m_transform.attach_mock(mock.Mock(), 'apply_all_rules')
            utc_now_str = 'socorro.processor.legacy_processor.utc_now'
            with mock.patch(utc_now_str) as m_utc_now:
                m_utc_now.return_value = datetime(2012, 5, 4, 15, 11,
                                                  tzinfo=UTC)

                raw_crash = DotDict()
                raw_crash.uuid = '3bc4bcaa-b61d-4d1f-85ae-30cb32120504'
                raw_crash.submitted_timestamp = '2012-05-04T15:33:33'
                raw_dump = {'upload_file_minidump': 'abcdef'}

                leg_proc = LegacyCrashProcessor(config, config.mock_quit_fn)

                started_timestamp = datetime(2012, 5, 4, 15, 10, tzinfo=UTC)
                leg_proc._log_job_start = mock.Mock(
                  return_value=started_timestamp
                )

                basic_processed_crash = DotDict()
                basic_processed_crash.uuid = raw_crash.uuid
                basic_processed_crash.success = False
                basic_processed_crash.hang_type = 0
                basic_processed_crash.java_stack_trace = None
                leg_proc._create_basic_processed_crash = mock.Mock(
                  return_value=basic_processed_crash)

                leg_proc._get_temp_dump_pathname = mock.Mock(
                  return_value='/tmp/x'
                )

                leg_proc._log_job_end = mock.Mock()

                processed_crash_update_dict = DotDict()
                processed_crash_update_dict.success = True
                leg_proc._do_breakpad_stack_dump_analysis = mock.Mock(
                  side_effect=Exception('nobody expects the spanish '
                                        'inquisition')
                )

                 # Here's the call being tested
                processed_crash = \
                    leg_proc.process_crash(
                      raw_crash,
                      raw_dump,
                      {}
                    )

                eq_(1, leg_proc._log_job_end.call_count)
                leg_proc._log_job_end.assert_called_with(
                  datetime(2012, 5, 4, 15, 11, tzinfo=UTC),
                  False,
                  raw_crash.uuid
                )

                e = {
                  'processor_notes':
                      'testing_processor:2012; LegacyCrashProcessor; '
                      'unrecoverable processor error: '
                      'nobody expects the spanish inquisition',
                  'completeddatetime': datetime(2012, 5, 4, 15, 11,
                                                tzinfo=UTC),
                  'success': False,
                  'uuid': raw_crash.uuid,
                  'hang_type': 0,
                  'java_stack_trace': None,
                  'additional_minidumps': [],
                }
                eq_(e, processed_crash)
                leg_proc._statistics.assert_has_calls(
                    [
                        mock.call.incr('jobs'),
                        mock.call.incr('restarts'),
                        mock.call.incr('errors'),
                    ],
                    any_order=True
                )
开发者ID:Krispy2009,项目名称:socorro,代码行数:85,代码来源:test_legacy_processor.py

示例3: test_process_crash_basic

# 需要导入模块: from socorro.processor.legacy_processor import LegacyCrashProcessor [as 别名]
# 或者: from socorro.processor.legacy_processor.LegacyCrashProcessor import _log_job_start [as 别名]
    def test_process_crash_basic(self):
        config = setup_config_with_mocks()
        mocked_transform_rules_str = \
            'socorro.processor.legacy_processor.TransformRuleSystem'
        with mock.patch(mocked_transform_rules_str) as m_transform_class:
            m_transform = mock.Mock()
            m_transform_class.return_value = m_transform
            m_transform.attach_mock(mock.Mock(), 'apply_all_rules')
            utc_now_str = 'socorro.processor.legacy_processor.utc_now'
            with mock.patch(utc_now_str) as m_utc_now:
                m_utc_now.return_value = datetime(2012, 5, 4, 15, 11,
                                                  tzinfo=UTC)

                raw_crash = DotDict()
                raw_crash.uuid = '3bc4bcaa-b61d-4d1f-85ae-30cb32120504'
                raw_crash.submitted_timestamp = '2012-05-04T15:33:33'
                raw_dump = {'upload_file_minidump':
                                '/some/path/%s.dump' % raw_crash.uuid,
                            'aux_dump_001':
                            '/some/path/aux_001.%s.dump' % raw_crash.uuid,
                            }
                leg_proc = LegacyCrashProcessor(config, config.mock_quit_fn)

                started_timestamp = datetime(2012, 5, 4, 15, 10, tzinfo=UTC)
                leg_proc._log_job_start = mock.Mock(
                  return_value=started_timestamp
                )

                basic_processed_crash = DotDict()
                basic_processed_crash.uuid = raw_crash.uuid
                basic_processed_crash.hang_type = 0
                basic_processed_crash.java_stack_trace = None
                leg_proc._create_basic_processed_crash = mock.Mock(
                  return_value=basic_processed_crash)

                leg_proc._log_job_end = mock.Mock()

                processed_crash_update_dict = DotDict()
                processed_crash_update_dict.success = True
                leg_proc._do_breakpad_stack_dump_analysis = mock.Mock(
                  return_value=processed_crash_update_dict
                )

                leg_proc._cleanup_temp_file = mock.Mock()

                 # Here's the call being tested
                processed_crash = \
                    leg_proc.process_crash(
                      raw_crash,
                      raw_dump,
                      {}
                    )

                # test the result
                eq_(1, leg_proc._log_job_start.call_count)
                leg_proc._log_job_start.assert_called_with(raw_crash.uuid)

                eq_(1, m_transform.apply_all_rules.call_count)
                m_transform.apply_all_rules.has_calls(
                    mock.call(raw_crash, leg_proc),
                )
                eq_(
                    1,
                    m_transform.apply_until_action_succeeds.call_count
                )
                m_transform.apply_all_rules.has_calls(
                    mock.call(raw_crash, processed_crash, leg_proc)
                )

                eq_(
                  1,
                  leg_proc._create_basic_processed_crash.call_count
                )
                leg_proc._create_basic_processed_crash.assert_called_with(
                  raw_crash.uuid,
                  raw_crash,
                  datetime(2012, 5, 4, 15, 33, 33, tzinfo=UTC),
                  started_timestamp,
                  [
                      'testing_processor:2012',
                      'LegacyCrashProcessor',
                      "Pipe dump missing from 'upload_file_minidump'",
                      "Pipe dump missing from 'aux_dump_001'"
                  ]
                )

                eq_(
                  2,
                  leg_proc._do_breakpad_stack_dump_analysis.call_count
                )
                first_call, second_call = \
                    leg_proc._do_breakpad_stack_dump_analysis.call_args_list
                eq_(
                  first_call,
                  ((raw_crash.uuid, '/some/path/%s.dump' % raw_crash.uuid,
                   0, None, datetime(2012, 5, 4, 15, 33, 33, tzinfo=UTC),
                   [
                      'testing_processor:2012',
                      'LegacyCrashProcessor',
                      "Pipe dump missing from 'upload_file_minidump'",
#.........这里部分代码省略.........
开发者ID:Krispy2009,项目名称:socorro,代码行数:103,代码来源:test_legacy_processor.py

示例4: test_convert_raw_crash_to_processed_crash_basic

# 需要导入模块: from socorro.processor.legacy_processor import LegacyCrashProcessor [as 别名]
# 或者: from socorro.processor.legacy_processor.LegacyCrashProcessor import _log_job_start [as 别名]
    def test_convert_raw_crash_to_processed_crash_basic(self):
        config = setup_config_with_mocks()
        mocked_transform_rules_str = "socorro.processor.legacy_processor.TransformRuleSystem"
        with mock.patch(mocked_transform_rules_str) as m_transform_class:
            m_transform = mock.Mock()
            m_transform_class.return_value = m_transform
            m_transform.attach_mock(mock.Mock(), "apply_all_rules")
            utc_now_str = "socorro.processor.legacy_processor.utc_now"
            with mock.patch(utc_now_str) as m_utc_now:
                m_utc_now.return_value = datetime(2012, 5, 4, 15, 11)

                raw_crash = DotDict()
                raw_crash.uuid = "3bc4bcaa-b61d-4d1f-85ae-30cb32120504"
                raw_crash.submitted_timestamp = "2012-05-04T15:33:33"
                raw_dump = "abcdef"
                leg_proc = LegacyCrashProcessor(config, config.mock_quit_fn)

                started_timestamp = datetime(2012, 5, 4, 15, 10)
                leg_proc._log_job_start = mock.Mock(return_value=started_timestamp)

                basic_processed_crash = DotDict()
                basic_processed_crash.uuid = raw_crash.uuid
                basic_processed_crash.hang_type = 0
                basic_processed_crash.java_stack_trace = None
                leg_proc._create_basic_processed_crash = mock.Mock(return_value=basic_processed_crash)

                leg_proc._get_temp_dump_pathname = mock.Mock(return_value="/tmp/x")

                leg_proc._log_job_end = mock.Mock()

                processed_crash_update_dict = DotDict()
                processed_crash_update_dict.success = True
                leg_proc._do_breakpad_stack_dump_analysis = mock.Mock(return_value=processed_crash_update_dict)

                leg_proc._cleanup_temp_file = mock.Mock()

                # Here's the call being tested
                processed_crash = leg_proc.convert_raw_crash_to_processed_crash(raw_crash, raw_dump)

                # test the result
                self.assertEqual(1, leg_proc._log_job_start.call_count)
                leg_proc._log_job_start.assert_called_with(raw_crash.uuid)

                self.assertEqual(1, m_transform.apply_all_rules.call_count)
                m_transform.apply_all_rules.assert_called_with(raw_crash, leg_proc)

                self.assertEqual(1, leg_proc._create_basic_processed_crash.call_count)
                leg_proc._create_basic_processed_crash.assert_called_with(
                    raw_crash.uuid, raw_crash, datetime(2012, 5, 4, 15, 33, 33, tzinfo=UTC), started_timestamp, []
                )

                self.assertEqual(1, leg_proc._get_temp_dump_pathname.call_count)
                leg_proc._get_temp_dump_pathname.assert_called_with(raw_crash.uuid, raw_dump)

                self.assertEqual(1, leg_proc._do_breakpad_stack_dump_analysis.call_count)
                leg_proc._do_breakpad_stack_dump_analysis.assert_called_with(
                    raw_crash.uuid, "/tmp/x", 0, None, datetime(2012, 5, 4, 15, 33, 33, tzinfo=UTC), []
                )

                self.assertEqual(1, leg_proc._cleanup_temp_file.call_count)
                leg_proc._cleanup_temp_file.assert_called_with("/tmp/x")

                self.assertEqual(1, leg_proc._log_job_end.call_count)
                leg_proc._log_job_end.assert_called_with(datetime(2012, 5, 4, 15, 11), True, raw_crash.uuid)

                epc = DotDict()
                epc.uuid = raw_crash.uuid
                epc.topmost_filenames = ""
                epc.processor_notes = ""
                epc.success = True
                epc.completeddatetime = datetime(2012, 5, 4, 15, 11)
                epc.hang_type = 0
                epc.java_stack_trace = None

                self.assertEqual(processed_crash, dict(epc))
开发者ID:katjakk,项目名称:socorro,代码行数:77,代码来源:test_legacy_processor.py

示例5: test_convert_raw_crash_to_processed_crash_basic

# 需要导入模块: from socorro.processor.legacy_processor import LegacyCrashProcessor [as 别名]
# 或者: from socorro.processor.legacy_processor.LegacyCrashProcessor import _log_job_start [as 别名]
    def test_convert_raw_crash_to_processed_crash_basic(self):
        config = setup_config_with_mocks()
        mocked_transform_rules_str = "socorro.processor.legacy_processor.TransformRuleSystem"
        with mock.patch(mocked_transform_rules_str) as m_transform_class:
            m_transform = mock.Mock()
            m_transform_class.return_value = m_transform
            m_transform.attach_mock(mock.Mock(), "apply_all_rules")
            utc_now_str = "socorro.processor.legacy_processor.utc_now"
            with mock.patch(utc_now_str) as m_utc_now:
                m_utc_now.return_value = datetime(2012, 5, 4, 15, 11, tzinfo=UTC)

                raw_crash = DotDict()
                raw_crash.uuid = "3bc4bcaa-b61d-4d1f-85ae-30cb32120504"
                raw_crash.submitted_timestamp = "2012-05-04T15:33:33"
                raw_dump = {
                    "upload_file_minidump": "/some/path/%s.dump" % raw_crash.uuid,
                    "aux_dump_001": "/some/path/aux_001.%s.dump" % raw_crash.uuid,
                }
                leg_proc = LegacyCrashProcessor(config, config.mock_quit_fn)

                started_timestamp = datetime(2012, 5, 4, 15, 10, tzinfo=UTC)
                leg_proc._log_job_start = mock.Mock(return_value=started_timestamp)

                basic_processed_crash = DotDict()
                basic_processed_crash.uuid = raw_crash.uuid
                basic_processed_crash.hang_type = 0
                basic_processed_crash.java_stack_trace = None
                leg_proc._create_basic_processed_crash = mock.Mock(return_value=basic_processed_crash)

                leg_proc._log_job_end = mock.Mock()

                processed_crash_update_dict = DotDict()
                processed_crash_update_dict.success = True
                leg_proc._do_breakpad_stack_dump_analysis = mock.Mock(return_value=processed_crash_update_dict)

                leg_proc._cleanup_temp_file = mock.Mock()

                # Here's the call being tested
                processed_crash = leg_proc.convert_raw_crash_to_processed_crash(raw_crash, raw_dump)

                # test the result
                self.assertEqual(1, leg_proc._log_job_start.call_count)
                leg_proc._log_job_start.assert_called_with(raw_crash.uuid)

                self.assertEqual(1, m_transform.apply_all_rules.call_count)
                m_transform.apply_all_rules.assert_called_with(raw_crash, leg_proc)

                self.assertEqual(1, leg_proc._create_basic_processed_crash.call_count)
                leg_proc._create_basic_processed_crash.assert_called_with(
                    raw_crash.uuid,
                    raw_crash,
                    datetime(2012, 5, 4, 15, 33, 33, tzinfo=UTC),
                    started_timestamp,
                    ["testing_processor:2012"],
                )

                self.assertEqual(2, leg_proc._do_breakpad_stack_dump_analysis.call_count)
                first_call, second_call = leg_proc._do_breakpad_stack_dump_analysis.call_args_list
                self.assertEqual(
                    first_call,
                    (
                        (
                            raw_crash.uuid,
                            "/some/path/%s.dump" % raw_crash.uuid,
                            0,
                            None,
                            datetime(2012, 5, 4, 15, 33, 33, tzinfo=UTC),
                            ["testing_processor:2012"],
                        ),
                    ),
                )
                self.assertEqual(
                    second_call,
                    (
                        (
                            raw_crash.uuid,
                            "/some/path/aux_001.%s.dump" % raw_crash.uuid,
                            0,
                            None,
                            datetime(2012, 5, 4, 15, 33, 33, tzinfo=UTC),
                            ["testing_processor:2012"],
                        ),
                    ),
                )

                self.assertEqual(1, leg_proc._log_job_end.call_count)
                leg_proc._log_job_end.assert_called_with(datetime(2012, 5, 4, 15, 11, tzinfo=UTC), True, raw_crash.uuid)

                epc = DotDict()
                epc.uuid = raw_crash.uuid
                epc.topmost_filenames = ""
                epc.processor_notes = "testing_processor:2012"
                epc.success = True
                epc.completeddatetime = datetime(2012, 5, 4, 15, 11, tzinfo=UTC)
                epc.hang_type = 0
                epc.java_stack_trace = None
                epc.Winsock_LSP = None
                epc.additional_minidumps = ["aux_dump_001"]
                epc.aux_dump_001 = {"success": True}
                self.assertEqual(processed_crash, dict(epc))
#.........这里部分代码省略.........
开发者ID:erikrose,项目名称:socorro,代码行数:103,代码来源:test_legacy_processor.py

示例6: test_convert_raw_crash_to_processed_crash_unexpected_error

# 需要导入模块: from socorro.processor.legacy_processor import LegacyCrashProcessor [as 别名]
# 或者: from socorro.processor.legacy_processor.LegacyCrashProcessor import _log_job_start [as 别名]
    def test_convert_raw_crash_to_processed_crash_unexpected_error(self):
        config = setup_config_with_mocks()
        mocked_transform_rules_str = \
            'socorro.processor.legacy_processor.TransformRuleSystem'
        with mock.patch(mocked_transform_rules_str) as m_transform_class:
            m_transform = mock.Mock()
            m_transform_class.return_value = m_transform
            m_transform.attach_mock(mock.Mock(), 'apply_all_rules')
            utc_now_str = 'socorro.processor.legacy_processor.utc_now'
            with mock.patch(utc_now_str) as m_utc_now:
                m_utc_now.return_value = datetime(2012, 5, 4, 15, 11)

                raw_crash = DotDict()
                raw_crash.uuid = '3bc4bcaa-b61d-4d1f-85ae-30cb32120504'
                raw_crash.submitted_timestamp = '2012-05-04T15:33:33'
                raw_dump = 'abcdef'

                leg_proc = LegacyCrashProcessor(config, config.mock_quit_fn)

                started_timestamp = datetime(2012, 5, 4, 15, 10)
                leg_proc._log_job_start = mock.Mock(
                  return_value=started_timestamp
                )

                basic_processed_crash = DotDict()
                basic_processed_crash.uuid = raw_crash.uuid
                basic_processed_crash.success = False
                basic_processed_crash.hang_type = 0
                basic_processed_crash.java_stack_trace = None
                leg_proc._create_basic_processed_crash = mock.Mock(
                  return_value=basic_processed_crash)

                leg_proc._get_temp_dump_pathname = mock.Mock(
                  return_value='/tmp/x'
                )

                leg_proc._log_job_end = mock.Mock()

                processed_crash_update_dict = DotDict()
                processed_crash_update_dict.success = True
                leg_proc._do_breakpad_stack_dump_analysis = mock.Mock(
                  side_effect=Exception('nobody expects the spanish '
                                        'inquisition')
                )

                leg_proc._cleanup_temp_file = mock.Mock()

                 # Here's the call being tested
                processed_crash = \
                    leg_proc.convert_raw_crash_to_processed_crash(
                      raw_crash,
                      raw_dump
                    )

                self.assertEqual(
                  1,
                  leg_proc._cleanup_temp_file.call_count
                )
                leg_proc._cleanup_temp_file.assert_called_with('/tmp/x')

                self.assertEqual(1, leg_proc._log_job_end.call_count)
                leg_proc._log_job_end.assert_called_with(
                  datetime(2012, 5, 4, 15, 11),
                  False,
                  raw_crash.uuid
                )

                e = {
                  'processor_notes': 'nobody expects the spanish inquisition',
                  'completeddatetime': datetime(2012, 5, 4, 15, 11),
                  'success': False,
                  'uuid': raw_crash.uuid,
                  'hang_type': 0,
                  'java_stack_trace': None,
                }
                self.assertEqual(e, processed_crash)
开发者ID:Meghashyamt,项目名称:socorro,代码行数:78,代码来源:test_legacy_processor.py


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