tree: 34a2a8397cb2fd12be8dfafc891a292dc7fbacb7 [path history] [tgz]
  1. api/
  2. bot_code/
  3. client/
  4. config/
  5. __main__.py
  6. main_test.py
  7. README.md
  8. signal_trace.py
  9. signal_trace_test.py
  10. swarmingserver_bot_fake.py
  11. test.py
  12. test_env_bot.py
  13. unittest.cfg
appengine/swarming/swarming_bot/README.md

Swarming bot code

Contains the code to run on the bots. This code has to be resilient enough to be able to self-update in case of partial destruction.

The server optionally has its own bot_config.py that will replace the file in this directory. This script provides domain specific dimensions and should self-register the bot on startup if desired.

The server replaces config.json with server-specific details.

Behavior

When the bot starts, the first thing it looks up is if it is the primary copy. If so, it immediately sets itself as swarming_bot.1.zip. Then it starts up itself. When running as swarming_bot.1.zip and it needs to upgrade, it switches to swarming_bot.2.zip. On the next upgrade, it goes back to .1.zip.

Code layout

This directory contains the main entry point to the bot and symlinks to useful directories (eg to the “client” directory, which contains the run_isolated script used by the bot). The three key subdirectories are:

  • api: code usable by both the bot config hooks and by the Swarming code.
  • bot_code: the actual Swarming bot code. Implements the main bot process and the task runner process. This code cannot be accessed by the bot config hooks; it is responsible for calling those hooks.
  • config: a default implementation of the bot config, including a default implementation of every hook.