From acb464c932c389c42e5c59ebdbb0be87b95ebe61 Mon Sep 17 00:00:00 2001 From: Diego Jardon Date: Tue, 12 May 2026 19:29:30 +0000 Subject: [PATCH 01/10] Add MAX_EXECUTIONS environment variable limit --- .../_internal/tests/core/bot/startup/run_bot_test.py | 12 ++++++++++++ src/python/bot/startup/run_bot.py | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py b/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py index 585ec248c32..0f1cc7219c0 100644 --- a/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py +++ b/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py @@ -107,6 +107,18 @@ def test_exception(self): self.assertFalse(clean_exit) self.assertEqual('payload', payload) + def test_max_executions(self): + """Test that the loop breaks after MAX_EXECUTIONS iterations.""" + os.environ['MAX_EXECUTIONS'] = '3' + # Use side_effect to avoid raising an exception so it loops cleanly. + self.mock.process_command.side_effect = None + + exception, clean_exit, payload = run_bot.task_loop() + + self.assertEqual(3, self.mock.process_command.call_count) + self.assertTrue(clean_exit) + self.assertEqual('payload', payload) + class LeaseAllTasksTest(unittest.TestCase): """Tests for lease_all_tasks.""" diff --git a/src/python/bot/startup/run_bot.py b/src/python/bot/startup/run_bot.py index 6825a28e149..0ab7d46ff69 100644 --- a/src/python/bot/startup/run_bot.py +++ b/src/python/bot/startup/run_bot.py @@ -120,6 +120,7 @@ def task_loop(): from clusterfuzz._internal.bot.tasks import commands clean_exit = False + execution_count = 0 while True: stacktrace = '' exception_occurred = False @@ -191,6 +192,13 @@ def task_loop(): time.sleep(utils.random_number(1, failure_wait_interval)) break + execution_count += 1 + max_executions = environment.get_value('MAX_EXECUTIONS') + if max_executions and execution_count >= int(max_executions): + logs.info('Reached MAX_EXECUTIONS limit (%s). Exiting.', max_executions) + clean_exit = True + break + task_payload = task.payload() if task else None return stacktrace, clean_exit, task_payload From 6d5eb78f137ec40a1b6cb51c35fc4f3a780ff069 Mon Sep 17 00:00:00 2001 From: Diego Jardon Date: Wed, 13 May 2026 15:44:36 +0000 Subject: [PATCH 02/10] Fix MAX_EXECUTIONS infinite loop and exception in task_loop - Fixed the `TypeError: info() takes 1 positional argument but 2 were given` exception when max_executions limit is reached. - Ensured environment re-evaluation in the `test_max_executions` unit test. - Mocked `update_task_enabled` correctly during tests. --- .../_internal/tests/core/bot/startup/run_bot_test.py | 4 ++++ src/python/bot/startup/run_bot.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py b/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py index 0f1cc7219c0..4175f1d08a8 100644 --- a/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py +++ b/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py @@ -89,7 +89,9 @@ def setUp(self): 'clusterfuzz._internal.bot.tasks.commands.process_command', 'clusterfuzz._internal.bot.tasks.update_task.run', 'clusterfuzz._internal.bot.tasks.update_task.track_revision', + 'python.bot.startup.run_bot.update_task_enabled', ]) + self.mock.update_task_enabled.return_value = True self.task = mock.MagicMock() self.task.payload.return_value = 'payload' @@ -109,6 +111,8 @@ def test_exception(self): def test_max_executions(self): """Test that the loop breaks after MAX_EXECUTIONS iterations.""" + from clusterfuzz._internal.system import environment + environment._initial_environment = None os.environ['MAX_EXECUTIONS'] = '3' # Use side_effect to avoid raising an exception so it loops cleanly. self.mock.process_command.side_effect = None diff --git a/src/python/bot/startup/run_bot.py b/src/python/bot/startup/run_bot.py index 0ab7d46ff69..2c71c1ecfb2 100644 --- a/src/python/bot/startup/run_bot.py +++ b/src/python/bot/startup/run_bot.py @@ -195,7 +195,7 @@ def task_loop(): execution_count += 1 max_executions = environment.get_value('MAX_EXECUTIONS') if max_executions and execution_count >= int(max_executions): - logs.info('Reached MAX_EXECUTIONS limit (%s). Exiting.', max_executions) + logs.info(f'Reached MAX_EXECUTIONS limit ({max_executions}). Exiting.') clean_exit = True break From 4b80b3b22fc307ef117f151b2283b899ef1c0232 Mon Sep 17 00:00:00 2001 From: Diego Jardon Date: Wed, 13 May 2026 15:50:45 +0000 Subject: [PATCH 03/10] Log error if MAX_EXECUTIONS is not an integer - Handles ValueError if MAX_EXECUTIONS cannot be parsed as an integer. - Removes the invalid value from the environment to prevent repeated errors. - Adds test coverage for the invalid input case. --- .../tests/core/bot/startup/run_bot_test.py | 16 ++++++++++++++++ src/python/bot/startup/run_bot.py | 13 +++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py b/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py index 4175f1d08a8..9377dac25ef 100644 --- a/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py +++ b/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py @@ -123,6 +123,22 @@ def test_max_executions(self): self.assertTrue(clean_exit) self.assertEqual('payload', payload) + @mock.patch('clusterfuzz._internal.metrics.logs.error') + def test_max_executions_invalid(self, mock_error): + """Test that an invalid MAX_EXECUTIONS logs an error and is removed.""" + from clusterfuzz._internal.system import environment + environment._initial_environment = None + os.environ['MAX_EXECUTIONS'] = 'invalid' + + # We need the loop to exit otherwise it will run indefinitely because we removed the limit. + # We can make process_command succeed once, then raise an exception so it exits. + self.mock.process_command.side_effect = [None, Exception('exit')] + + exception, clean_exit, payload = run_bot.task_loop() + + mock_error.assert_any_call('Invalid value for MAX_EXECUTIONS: invalid') + self.assertEqual(2, self.mock.process_command.call_count) + class LeaseAllTasksTest(unittest.TestCase): """Tests for lease_all_tasks.""" diff --git a/src/python/bot/startup/run_bot.py b/src/python/bot/startup/run_bot.py index 2c71c1ecfb2..5650a444d0e 100644 --- a/src/python/bot/startup/run_bot.py +++ b/src/python/bot/startup/run_bot.py @@ -194,10 +194,15 @@ def task_loop(): execution_count += 1 max_executions = environment.get_value('MAX_EXECUTIONS') - if max_executions and execution_count >= int(max_executions): - logs.info(f'Reached MAX_EXECUTIONS limit ({max_executions}). Exiting.') - clean_exit = True - break + if max_executions: + try: + if execution_count >= int(max_executions): + logs.info(f'Reached MAX_EXECUTIONS limit ({max_executions}). Exiting.') + clean_exit = True + break + except ValueError: + logs.error(f'Invalid value for MAX_EXECUTIONS: {max_executions}') + environment.remove_key('MAX_EXECUTIONS') task_payload = task.payload() if task else None return stacktrace, clean_exit, task_payload From da2f31d4ddc53022ee7522fdf0fd678470bc6117 Mon Sep 17 00:00:00 2001 From: Diego Jardon Date: Wed, 13 May 2026 15:54:21 +0000 Subject: [PATCH 04/10] Refactor MAX_EXECUTIONS validation for better readability - Removed extra indentation by utilizing Python's short-circuit evaluation inside a single try-except block. --- src/python/bot/startup/run_bot.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/python/bot/startup/run_bot.py b/src/python/bot/startup/run_bot.py index 5650a444d0e..32d97ad94eb 100644 --- a/src/python/bot/startup/run_bot.py +++ b/src/python/bot/startup/run_bot.py @@ -194,15 +194,14 @@ def task_loop(): execution_count += 1 max_executions = environment.get_value('MAX_EXECUTIONS') - if max_executions: - try: - if execution_count >= int(max_executions): - logs.info(f'Reached MAX_EXECUTIONS limit ({max_executions}). Exiting.') - clean_exit = True - break - except ValueError: - logs.error(f'Invalid value for MAX_EXECUTIONS: {max_executions}') - environment.remove_key('MAX_EXECUTIONS') + try: + if max_executions and execution_count >= int(max_executions): + logs.info(f'Reached MAX_EXECUTIONS limit ({max_executions}). Exiting.') + clean_exit = True + break + except ValueError: + logs.error(f'Invalid value for MAX_EXECUTIONS: {max_executions}') + environment.remove_key('MAX_EXECUTIONS') task_payload = task.payload() if task else None return stacktrace, clean_exit, task_payload From c6203fd00a517ea6a2aa38033037256c9aecf525 Mon Sep 17 00:00:00 2001 From: Diego Jardon Date: Wed, 13 May 2026 15:57:07 +0000 Subject: [PATCH 05/10] Extract _get_max_executions helper for cleaner task_loop logic --- src/python/bot/startup/run_bot.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/python/bot/startup/run_bot.py b/src/python/bot/startup/run_bot.py index 32d97ad94eb..35a3eed5110 100644 --- a/src/python/bot/startup/run_bot.py +++ b/src/python/bot/startup/run_bot.py @@ -114,6 +114,19 @@ def schedule_utask_mains(): task.pubsub_task.cancel_lease_ack() +def _get_max_executions(): + """Returns the MAX_EXECUTIONS limit as an int, or None if invalid/unset.""" + val = environment.get_value('MAX_EXECUTIONS') + if not val: + return None + try: + return int(val) + except ValueError: + logs.error(f'Invalid value for MAX_EXECUTIONS: {val}') + environment.remove_key('MAX_EXECUTIONS') + return None + + def task_loop(): """Executes tasks indefinitely.""" # Defer heavy task imports to prevent issues with multiprocessing.Process @@ -193,15 +206,11 @@ def task_loop(): break execution_count += 1 - max_executions = environment.get_value('MAX_EXECUTIONS') - try: - if max_executions and execution_count >= int(max_executions): - logs.info(f'Reached MAX_EXECUTIONS limit ({max_executions}). Exiting.') - clean_exit = True - break - except ValueError: - logs.error(f'Invalid value for MAX_EXECUTIONS: {max_executions}') - environment.remove_key('MAX_EXECUTIONS') + max_executions = _get_max_executions() + if max_executions and execution_count >= max_executions: + logs.info(f'Reached MAX_EXECUTIONS limit ({max_executions}). Exiting.') + clean_exit = True + break task_payload = task.payload() if task else None return stacktrace, clean_exit, task_payload From 5326c42fe2e28e350cc78cfea41c987215b2e8da Mon Sep 17 00:00:00 2001 From: Diego Jardon Date: Wed, 13 May 2026 22:33:47 +0000 Subject: [PATCH 06/10] Fix unused variables and whitespace in run_bot_test.py --- .../tests/core/bot/startup/run_bot_test.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py b/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py index 9377dac25ef..e3d1d63ed50 100644 --- a/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py +++ b/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py @@ -116,9 +116,9 @@ def test_max_executions(self): os.environ['MAX_EXECUTIONS'] = '3' # Use side_effect to avoid raising an exception so it loops cleanly. self.mock.process_command.side_effect = None - - exception, clean_exit, payload = run_bot.task_loop() - + + _, clean_exit, payload = run_bot.task_loop() + self.assertEqual(3, self.mock.process_command.call_count) self.assertTrue(clean_exit) self.assertEqual('payload', payload) @@ -129,13 +129,13 @@ def test_max_executions_invalid(self, mock_error): from clusterfuzz._internal.system import environment environment._initial_environment = None os.environ['MAX_EXECUTIONS'] = 'invalid' - + # We need the loop to exit otherwise it will run indefinitely because we removed the limit. # We can make process_command succeed once, then raise an exception so it exits. self.mock.process_command.side_effect = [None, Exception('exit')] - - exception, clean_exit, payload = run_bot.task_loop() - + + _, _, _ = run_bot.task_loop() + mock_error.assert_any_call('Invalid value for MAX_EXECUTIONS: invalid') self.assertEqual(2, self.mock.process_command.call_count) From 6ca19f68b1d4f7159d0a6f643ad19ec0ec3a96ce Mon Sep 17 00:00:00 2001 From: Diego Jardon Date: Wed, 20 May 2026 03:44:41 +0000 Subject: [PATCH 07/10] Rename MAX_EXECUTIONS to MAX_TASK_EXECUTIONS --- .../tests/core/bot/startup/run_bot_test.py | 10 +++++----- src/python/bot/startup/run_bot.py | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py b/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py index e3d1d63ed50..2822b1a2bdc 100644 --- a/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py +++ b/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py @@ -110,10 +110,10 @@ def test_exception(self): self.assertEqual('payload', payload) def test_max_executions(self): - """Test that the loop breaks after MAX_EXECUTIONS iterations.""" + """Test that the loop breaks after MAX_TASK_EXECUTIONS iterations.""" from clusterfuzz._internal.system import environment environment._initial_environment = None - os.environ['MAX_EXECUTIONS'] = '3' + os.environ['MAX_TASK_EXECUTIONS'] = '3' # Use side_effect to avoid raising an exception so it loops cleanly. self.mock.process_command.side_effect = None @@ -125,10 +125,10 @@ def test_max_executions(self): @mock.patch('clusterfuzz._internal.metrics.logs.error') def test_max_executions_invalid(self, mock_error): - """Test that an invalid MAX_EXECUTIONS logs an error and is removed.""" + """Test that an invalid MAX_TASK_EXECUTIONS logs an error and is removed.""" from clusterfuzz._internal.system import environment environment._initial_environment = None - os.environ['MAX_EXECUTIONS'] = 'invalid' + os.environ['MAX_TASK_EXECUTIONS'] = 'invalid' # We need the loop to exit otherwise it will run indefinitely because we removed the limit. # We can make process_command succeed once, then raise an exception so it exits. @@ -136,7 +136,7 @@ def test_max_executions_invalid(self, mock_error): _, _, _ = run_bot.task_loop() - mock_error.assert_any_call('Invalid value for MAX_EXECUTIONS: invalid') + mock_error.assert_any_call('Invalid value for MAX_TASK_EXECUTIONS: invalid') self.assertEqual(2, self.mock.process_command.call_count) diff --git a/src/python/bot/startup/run_bot.py b/src/python/bot/startup/run_bot.py index 35a3eed5110..fc59e4c1fd7 100644 --- a/src/python/bot/startup/run_bot.py +++ b/src/python/bot/startup/run_bot.py @@ -114,16 +114,16 @@ def schedule_utask_mains(): task.pubsub_task.cancel_lease_ack() -def _get_max_executions(): - """Returns the MAX_EXECUTIONS limit as an int, or None if invalid/unset.""" - val = environment.get_value('MAX_EXECUTIONS') +def _get_max_task_executions(): + """Returns the MAX_TASK_EXECUTIONS limit as an int, or None if invalid/unset.""" + val = environment.get_value('MAX_TASK_EXECUTIONS') if not val: return None try: return int(val) except ValueError: - logs.error(f'Invalid value for MAX_EXECUTIONS: {val}') - environment.remove_key('MAX_EXECUTIONS') + logs.error(f'Invalid value for MAX_TASK_EXECUTIONS: {val}') + environment.remove_key('MAX_TASK_EXECUTIONS') return None @@ -206,9 +206,9 @@ def task_loop(): break execution_count += 1 - max_executions = _get_max_executions() - if max_executions and execution_count >= max_executions: - logs.info(f'Reached MAX_EXECUTIONS limit ({max_executions}). Exiting.') + max_task_executions = _get_max_task_executions() + if max_task_executions and execution_count >= max_task_executions: + logs.info(f'Reached MAX_TASK_EXECUTIONS limit ({max_task_executions}). Exiting.') clean_exit = True break From 37cf8e5dc30b286dc0a038d122565d6ab66312ad Mon Sep 17 00:00:00 2001 From: Diego Jardon Date: Wed, 20 May 2026 03:48:52 +0000 Subject: [PATCH 08/10] Address PR feedback for MAX_TASK_EXECUTIONS - Fail fast with log_fatal_and_exit on invalid env values - Move max_task_executions retrieval outside the task loop - Use correct log format args for metrics.logs.info - Clean up test mock assignments and assert SystemExit --- .../tests/core/bot/startup/run_bot_test.py | 21 ++++++++----------- src/python/bot/startup/run_bot.py | 10 ++++----- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py b/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py index 2822b1a2bdc..b46049cd7e9 100644 --- a/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py +++ b/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py @@ -114,8 +114,7 @@ def test_max_executions(self): from clusterfuzz._internal.system import environment environment._initial_environment = None os.environ['MAX_TASK_EXECUTIONS'] = '3' - # Use side_effect to avoid raising an exception so it loops cleanly. - self.mock.process_command.side_effect = None + self.mock.process_command.return_value = None _, clean_exit, payload = run_bot.task_loop() @@ -123,21 +122,19 @@ def test_max_executions(self): self.assertTrue(clean_exit) self.assertEqual('payload', payload) - @mock.patch('clusterfuzz._internal.metrics.logs.error') - def test_max_executions_invalid(self, mock_error): - """Test that an invalid MAX_TASK_EXECUTIONS logs an error and is removed.""" + @mock.patch('clusterfuzz._internal.metrics.logs.log_fatal_and_exit') + def test_max_executions_invalid(self, mock_log_fatal_and_exit): + """Test that an invalid MAX_TASK_EXECUTIONS logs a fatal error and exits.""" from clusterfuzz._internal.system import environment environment._initial_environment = None os.environ['MAX_TASK_EXECUTIONS'] = 'invalid' + mock_log_fatal_and_exit.side_effect = SystemExit - # We need the loop to exit otherwise it will run indefinitely because we removed the limit. - # We can make process_command succeed once, then raise an exception so it exits. - self.mock.process_command.side_effect = [None, Exception('exit')] + with self.assertRaises(SystemExit): + run_bot.task_loop() - _, _, _ = run_bot.task_loop() - - mock_error.assert_any_call('Invalid value for MAX_TASK_EXECUTIONS: invalid') - self.assertEqual(2, self.mock.process_command.call_count) + mock_log_fatal_and_exit.assert_any_call('Invalid value for MAX_TASK_EXECUTIONS: invalid') + self.assertEqual(0, self.mock.process_command.call_count) class LeaseAllTasksTest(unittest.TestCase): diff --git a/src/python/bot/startup/run_bot.py b/src/python/bot/startup/run_bot.py index fc59e4c1fd7..a05507cb558 100644 --- a/src/python/bot/startup/run_bot.py +++ b/src/python/bot/startup/run_bot.py @@ -122,9 +122,7 @@ def _get_max_task_executions(): try: return int(val) except ValueError: - logs.error(f'Invalid value for MAX_TASK_EXECUTIONS: {val}') - environment.remove_key('MAX_TASK_EXECUTIONS') - return None + logs.log_fatal_and_exit(f'Invalid value for MAX_TASK_EXECUTIONS: {val}') def task_loop(): @@ -134,6 +132,8 @@ def task_loop(): clean_exit = False execution_count = 0 + max_task_executions = _get_max_task_executions() + while True: stacktrace = '' exception_occurred = False @@ -206,9 +206,9 @@ def task_loop(): break execution_count += 1 - max_task_executions = _get_max_task_executions() if max_task_executions and execution_count >= max_task_executions: - logs.info(f'Reached MAX_TASK_EXECUTIONS limit ({max_task_executions}). Exiting.') + logs.info('Reached MAX_TASK_EXECUTIONS limit. Exiting.', + max_task_executions=max_task_executions) clean_exit = True break From 126f0b4f425a088c9352e97bd22a7145329e142c Mon Sep 17 00:00:00 2001 From: Diego Jardon Date: Wed, 20 May 2026 04:02:46 +0000 Subject: [PATCH 09/10] Fix pylint and formatting errors in run_bot --- .../_internal/tests/core/bot/startup/run_bot_test.py | 4 ++-- src/python/bot/startup/run_bot.py | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py b/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py index b46049cd7e9..2418a79036c 100644 --- a/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py +++ b/src/clusterfuzz/_internal/tests/core/bot/startup/run_bot_test.py @@ -114,7 +114,6 @@ def test_max_executions(self): from clusterfuzz._internal.system import environment environment._initial_environment = None os.environ['MAX_TASK_EXECUTIONS'] = '3' - self.mock.process_command.return_value = None _, clean_exit, payload = run_bot.task_loop() @@ -133,7 +132,8 @@ def test_max_executions_invalid(self, mock_log_fatal_and_exit): with self.assertRaises(SystemExit): run_bot.task_loop() - mock_log_fatal_and_exit.assert_any_call('Invalid value for MAX_TASK_EXECUTIONS: invalid') + mock_log_fatal_and_exit.assert_any_call( + 'Invalid value for MAX_TASK_EXECUTIONS: invalid') self.assertEqual(0, self.mock.process_command.call_count) diff --git a/src/python/bot/startup/run_bot.py b/src/python/bot/startup/run_bot.py index a05507cb558..596fecb016f 100644 --- a/src/python/bot/startup/run_bot.py +++ b/src/python/bot/startup/run_bot.py @@ -115,7 +115,8 @@ def schedule_utask_mains(): def _get_max_task_executions(): - """Returns the MAX_TASK_EXECUTIONS limit as an int, or None if invalid/unset.""" + """Returns the MAX_TASK_EXECUTIONS limit as an int, or None if + invalid/unset.""" val = environment.get_value('MAX_TASK_EXECUTIONS') if not val: return None @@ -123,6 +124,7 @@ def _get_max_task_executions(): return int(val) except ValueError: logs.log_fatal_and_exit(f'Invalid value for MAX_TASK_EXECUTIONS: {val}') + return None def task_loop(): @@ -207,8 +209,9 @@ def task_loop(): execution_count += 1 if max_task_executions and execution_count >= max_task_executions: - logs.info('Reached MAX_TASK_EXECUTIONS limit. Exiting.', - max_task_executions=max_task_executions) + logs.info( + 'Reached MAX_TASK_EXECUTIONS limit. Exiting.', + max_task_executions=max_task_executions) clean_exit = True break From 834df04257d39a460f5801a71cdf0cbfe1e988c1 Mon Sep 17 00:00:00 2001 From: Diego Jardon Date: Wed, 20 May 2026 04:09:07 +0000 Subject: [PATCH 10/10] Use pylint pragma instead of dead code --- src/python/bot/startup/run_bot.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/python/bot/startup/run_bot.py b/src/python/bot/startup/run_bot.py index 596fecb016f..671ddadd735 100644 --- a/src/python/bot/startup/run_bot.py +++ b/src/python/bot/startup/run_bot.py @@ -114,7 +114,7 @@ def schedule_utask_mains(): task.pubsub_task.cancel_lease_ack() -def _get_max_task_executions(): +def _get_max_task_executions(): # pylint: disable=inconsistent-return-statements """Returns the MAX_TASK_EXECUTIONS limit as an int, or None if invalid/unset.""" val = environment.get_value('MAX_TASK_EXECUTIONS') @@ -124,7 +124,6 @@ def _get_max_task_executions(): return int(val) except ValueError: logs.log_fatal_and_exit(f'Invalid value for MAX_TASK_EXECUTIONS: {val}') - return None def task_loop():