MCPcopy Index your code
hub / github.com/google/clusterfuzz / run_loop

Function run_loop

src/python/bot/startup/run.py:190–214  ·  view source on GitHub ↗

Run infinite loop with bot's command.

(bot_command, heartbeat_command)

Source from the content-addressed store, hash-verified

188
189
190def run_loop(bot_command, heartbeat_command):
191 """Run infinite loop with bot's command."""
192 atexit.register(stop_heartbeat)
193 if environment.is_android():
194 atexit.register(stop_android_heartbeat)
195
196 while True:
197 update_source_code_if_needed()
198 if not environment.is_uworker():
199 if environment.is_android():
200 start_android_heartbeat()
201 start_heartbeat(heartbeat_command)
202 exit_code = start_bot(bot_command)
203 if environment.is_uworker():
204 logs.info(f'Job exited with code: {exit_code}. Exiting.')
205 sys.exit(exit_code)
206
207 # See if our run timed out, if yes bail out.
208 try:
209 if data_handler.bot_run_timed_out():
210 break
211 except Exception:
212 logs.error('Failed to check for bot run timeout.')
213
214 sleep(LOOP_SLEEP_INTERVAL)
215
216
217def set_start_time():

Callers 1

mainFunction · 0.85

Calls 6

start_android_heartbeatFunction · 0.85
start_heartbeatFunction · 0.85
start_botFunction · 0.85
errorMethod · 0.80
sleepFunction · 0.70

Tested by

no test coverage detected