Skip to content

Commit

Permalink
remove processor chatty flag
Browse files Browse the repository at this point in the history
this removes the chatty and chatty_rules flags and associated outputs from the processor and processor rules. a single rule was configured with chatty=true but a previous commit already inlined additional log output the flag would have generated. several tests set the value to true without asserting claims about the output.
  • Loading branch information
lonnen committed Feb 21, 2018
1 parent 58856b5 commit 9f84ef3
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 94 deletions.
26 changes: 2 additions & 24 deletions socorro/lib/transform_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ class Rule(RequiredConfig):
"""the base class for Support Rules. It provides the framework for the
rules 'predicate', 'action', and 'version' as well as utilites to help
rules do their jobs."""
required_config = Namespace()
required_config.add_option(
'chatty',
doc='should this rule announce what it is doing?',
default=False,
)

def __init__(self, config=None, quit_check_callback=None):
self.config = config
Expand Down Expand Up @@ -339,11 +333,6 @@ class TransformRuleSystem(RequiredConfig):
name='rules_list',
default=[]
)
required_config.add_option(
'chatty_rules',
doc='should the rules announce what they are doing?',
default=False,
)

def __init__(self, config=None, quit_check=None):
if quit_check:
Expand All @@ -353,8 +342,7 @@ def __init__(self, config=None, quit_check=None):
self.rules = []
if not config:
config = DotDict()
if 'chatty_rules' not in config:
config.chatty_rules = False

self.config = config
if "rules_list" in config:
list_of_rules = config.rules_list.class_list
Expand Down Expand Up @@ -388,18 +376,8 @@ def apply_all_rules(self, *args, **kwargs):
True - since success or failure is ignored"""
for x in self.rules:
self._quit_check()
if self.config.chatty_rules:
self.config.logger.debug(
'apply_all_rules: %s',
to_str(x.__class__)
)
predicate_result, action_result = x.act(*args, **kwargs)
if self.config.chatty_rules:
self.config.logger.debug(
' : pred - %s; act - %s',
predicate_result,
action_result
)

return True

def close(self):
Expand Down
15 changes: 0 additions & 15 deletions socorro/processor/breakpad_transform_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,6 @@ def _interpret_external_command_output(self, fp, processor_meta):
return {}

def _execute_external_process(self, command_line, processor_meta):
if self.config.get('chatty', False):
self.config.logger.debug(
"External Command: %s",
command_line
)
subprocess_handle = subprocess.Popen(
command_line,
shell=True,
Expand Down Expand Up @@ -352,13 +347,6 @@ def _action(self, raw_crash, raw_dumps, processed_crash, processor_meta):

dump_file_pathname = raw_dumps[dump_name]

if self.config.get('chatty'):
self.config.logger.debug(
"BreakpadStackwalkerRule2015: %s, %s",
dump_name,
dump_file_pathname
)

command_line = self.expand_commandline(
dump_file_pathname=dump_file_pathname,
raw_crash_pathname=raw_crash_pathname
Expand Down Expand Up @@ -409,9 +397,6 @@ class JitCrashCategorizeRule(ExternalProcessRule):
default=8
)

def __init__(self, config):
super(JitCrashCategorizeRule, self).__init__(config)

def _predicate(self, raw_crash, raw_dumps, processed_crash, proc_meta):
if (
processed_crash.product != 'Firefox' or
Expand Down
13 changes: 0 additions & 13 deletions socorro/processor/mozilla_transform_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,25 +158,12 @@ def _action(self, raw_crash, raw_dumps, processed_crash, processor_meta):

original_addon_str = raw_crash.get('Add-ons', '')
if not original_addon_str:
if self.config.chatty:
self.config.logger.debug(
'AddonsRule: no addons'
)
processed_crash.addons = []
else:
if self.config.chatty:
self.config.logger.debug(
'AddonsRule: trying to split addons'
)
processed_crash.addons = [
unquote_plus(self._get_formatted_addon(x))
for x in original_addon_str.split(',')
]
if self.config.chatty:
self.config.logger.debug(
'AddonsRule: done: %s',
processed_crash.addons
)

return True

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ class TestStatsdCountAnythingRule(TestCase):

def setup_config(self, prefix=None):
config = DotDict()
config.chatty_rules = False
config.chatty = False
config.tag = 'test.rule'
config.action = 'apply_all_rules'
config.rules_list = DotDict()
Expand Down
14 changes: 0 additions & 14 deletions socorro/unittest/lib/test_transform_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,6 @@ def increment_1(s, d):
def test_rule_simple(self):
fake_config = DotDict()
fake_config.logger = Mock()
fake_config.chatty_rules = False
fake_config.chatty = False

r1 = transform_rules.Rule(fake_config)
assert r1.predicate(None, None, None, None) is True
Expand Down Expand Up @@ -350,8 +348,6 @@ def _action(self, *args, **kwargs):
def test_rule_exceptions(self):
fake_config = DotDict()
fake_config.logger = Mock()
fake_config.chatty_rules = False
fake_config.chatty = False

class BadPredicate(transform_rules.Rule):

Expand Down Expand Up @@ -418,8 +414,6 @@ def mock_Client(**config):

fake_config = DotDict()
fake_config.logger = Mock()
fake_config.chatty_rules = False
fake_config.chatty = False
fake_config.sentry = DotDict()

class SomeError(Exception):
Expand Down Expand Up @@ -487,8 +481,6 @@ def mock_Client(**config):

fake_config = DotDict()
fake_config.logger = Mock()
fake_config.chatty_rules = False
fake_config.chatty = False
fake_config.sentry = DotDict()
fake_config.sentry.dsn = (
'https://6e48583:[email protected]/01'
Expand All @@ -514,8 +506,6 @@ def _predicate(self, *args, **kwargs):

def test_rules_in_config(self):
config = DotDict()
config.chatty_rules = False
config.chatty = False
config.tag = 'test.rule'
config.action = 'apply_all_rules'
config['RuleTestLaughable.laughable'] = 'wilma'
Expand Down Expand Up @@ -543,8 +533,6 @@ def test_rules_in_config(self):
def test_rules_close(self):
config = DotDict()
config.logger = Mock().s
config.chatty_rules = False
config.chatty = False
config.tag = 'test.rule'
config.action = 'apply_all_rules'
config['RuleTestLaughable.laughable'] = 'wilma'
Expand Down Expand Up @@ -572,8 +560,6 @@ def test_rules_close(self):
def test_rules_close_if_close_method_available(self):
config = DotDict()
config.logger = Mock()
config.chatty_rules = False
config.chatty = False
config.tag = 'test.rule'
config.action = 'apply_all_rules'
config.rules_list = DotDict()
Expand Down
4 changes: 0 additions & 4 deletions socorro/unittest/processor/test_breakpad_transform_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ class TestCrashingThreadRule(TestCase):
def get_basic_config(self):
config = CDotDict()
config.logger = Mock()
config.chatty = True
return config

def get_basic_processor_meta(self):
Expand Down Expand Up @@ -255,7 +254,6 @@ class TestExternalProcessRule(TestCase):
def get_basic_config(self):
config = CDotDict()
config.logger = Mock()
config.chatty = True
config.dump_field = 'upload_file_minidump'
config.command_line = (
'timeout -s KILL 30 {command_pathname} '
Expand Down Expand Up @@ -391,7 +389,6 @@ class TestBreakpadTransformRule2015(TestCase):
def get_basic_config(self):
config = CDotDict()
config.logger = Mock()
config.chatty = True
config.dump_field = 'upload_file_minidump'
config.command_line = (
BreakpadStackwalkerRule2015.required_config .command_line.default
Expand Down Expand Up @@ -523,7 +520,6 @@ class TestJitCrashCategorizeRule(TestCase):
def get_basic_config(self):
config = CDotDict()
config.logger = Mock()
config.chatty = True
config.dump_field = 'upload_file_minidump'
config.command_line = (
JitCrashCategorizeRule.required_config.command_line.default
Expand Down
28 changes: 6 additions & 22 deletions socorro/unittest/processor/test_mozilla_transform_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ class TestProductRule(TestCase):
def get_basic_config(self):
config = CDotDict()
config.logger = Mock()
config.chatty = False

return config

Expand Down Expand Up @@ -221,8 +220,6 @@ class TestUserDataRule(TestCase):
def get_basic_config(self):
config = CDotDict()
config.logger = Mock()
config.chatty = False

return config

def get_basic_processor_meta(self):
Expand Down Expand Up @@ -276,7 +273,6 @@ class TestEnvironmentRule(TestCase):
def get_basic_config(self):
config = CDotDict()
config.logger = Mock()
config.chatty = False

return config

Expand Down Expand Up @@ -324,7 +320,6 @@ class TestPluginRule(TestCase):
def get_basic_config(self):
config = CDotDict()
config.logger = Mock()
config.chatty = False

return config

Expand Down Expand Up @@ -388,7 +383,6 @@ class TestAddonsRule(TestCase):
def get_basic_config(self):
config = CDotDict()
config.logger = Mock()
config.chatty = False

return config

Expand Down Expand Up @@ -476,7 +470,6 @@ class TestDatesAndTimesRule(TestCase):
def get_basic_config(self):
config = CDotDict()
config.logger = Mock()
config.chatty = False

return config

Expand Down Expand Up @@ -748,7 +741,6 @@ class TestJavaProcessRule(TestCase):
def get_basic_config(self):
config = CDotDict()
config.logger = Mock()
config.chatty = False

return config

Expand Down Expand Up @@ -797,7 +789,6 @@ class TestOutOfMemoryBinaryRule(TestCase):
def get_basic_config(self):
config = CDotDict()
config.logger = Mock()
config.chatty = False

return config

Expand Down Expand Up @@ -904,7 +895,6 @@ def test_extract_memory_info_with_json_trouble(self):
config = CDotDict()
config.max_size_uncompressed = 1024
config.logger = Mock()
config.chatty = False

raw_crash = copy.copy(canonical_standard_raw_crash)
raw_crash.JavaStackTrace = "this is a Java Stack trace"
Expand Down Expand Up @@ -982,7 +972,6 @@ class TestProductRewrite(TestCase):
def get_basic_config(self):
config = CDotDict()
config.logger = Mock()
config.chatty = False

return config

Expand Down Expand Up @@ -1035,7 +1024,6 @@ class TestESRVersionRewrite(TestCase):
def get_basic_config(self):
config = CDotDict()
config.logger = Mock()
config.chatty = False

return config

Expand Down Expand Up @@ -1110,7 +1098,6 @@ class TestPluginContentURL(TestCase):
def get_basic_config(self):
config = CDotDict()
config.logger = Mock()
config.chatty = False

return config

Expand Down Expand Up @@ -1165,7 +1152,6 @@ class TestPluginUserComment(TestCase):
def get_basic_config(self):
config = CDotDict()
config.logger = Mock()
config.chatty = False

return config

Expand Down Expand Up @@ -1220,7 +1206,6 @@ class TestExploitablityRule(TestCase):
def get_basic_config(self):
config = CDotDict()
config.logger = Mock()
config.chatty = False

return config

Expand Down Expand Up @@ -1272,7 +1257,7 @@ class TestFlashVersionRule(TestCase):
def get_basic_config(self):
config = CDotDict()
config.logger = Mock()
config.chatty = False

config.flash_re = re.compile(
FlashVersionRule.required_config.flash_re.default
)
Expand Down Expand Up @@ -1347,7 +1332,7 @@ class TestWinsock_LSPRule(TestCase):
def get_basic_config(self):
config = CDotDict()
config.logger = Mock()
config.chatty = False

return config

def get_basic_processor_meta(self):
Expand Down Expand Up @@ -1402,7 +1387,7 @@ class TestTopMostFilesRule(TestCase):
def get_basic_config(self):
config = CDotDict()
config.logger = Mock()
config.chatty = False

return config

def get_basic_processor_meta(self):
Expand Down Expand Up @@ -1513,7 +1498,7 @@ class TestBetaVersion(TestCase):
def get_basic_config(self):
config = CDotDict()
config.logger = Mock()
config.chatty = False

return config

def get_basic_processor_meta(self):
Expand Down Expand Up @@ -1626,7 +1611,7 @@ class TestAuroraVersionFixitRule:
def get_basic_config(self):
config = CDotDict()
config.logger = Mock()
config.chatty = False

return config

def test_predicate(self):
Expand Down Expand Up @@ -1659,7 +1644,6 @@ class TestOsPrettyName(TestCase):
def test_everything_we_hoped_for(self):
config = CDotDict()
config.logger = Mock()
config.chatty = False

raw_crash = copy.copy(canonical_standard_raw_crash)
raw_dumps = {}
Expand Down Expand Up @@ -1751,7 +1735,7 @@ class TestThemePrettyNameRule(TestCase):
def get_basic_config(self):
config = CDotDict()
config.logger = Mock()
config.chatty = False

return config

def get_basic_processor_meta(self):
Expand Down

0 comments on commit 9f84ef3

Please sign in to comment.