tree: 2943f5999defdf13ade1ce327af1a4a86cf56ab1 [path history] [tgz]
  1. apt-full-upgrade.py
  2. BUILD.bazel
  3. cleanup_docker.py
  4. delete_cached_repos.py
  5. delete_isolate_cache.py
  6. delete_out_dirs.py
  7. delete_tmp_dirs.py
  8. install_docker.py
  9. install_zip.py
  10. power_off_bot.py
  11. README.md
  12. reboot_bot.py
  13. run_on_swarming_bots.go
scripts/run_on_swarming_bots/README.md

Batch Running Custom Tasks On Swarming

Some times, we want to run a custom script on many swarming bots. Typically, this is performing maintenance on a swarming bot, like updating/removing an installed application or cleaning up disk space.

This go program, run_on_swarming_bots, makes that easy.

First, run the program in dry run mode to make sure you have your dimensions correct and thus are running the script on the right set of bots. Protip: if you want a single bot, you can specify it with the id dimension (id:skia-e-gce-123).

$ go run scripts/run_on_swarming_bots/run_on_swarming_bots.go \
    --dimension docker_installed:true --dimension gce:1 \
    --dry_run
# output should include lines like:
#   run_on_swarming_bots.go:135 Dry run mode.  Would run on following bots:
#   run_on_swarming_bots.go:137 skia-e-gce-100
#   run_on_swarming_bots.go:137 skia-e-gce-101
#   run_on_swarming_bots.go:137 skia-e-gce-102
# and then the program exits.

Finally, include your script. Your script will run on all swarming bots that match the specified dimensions.

$ go run scripts/run_on_swarming_bots/run_on_swarming_bots.go \
    --dimension docker_installed:true --dimension gce:1 \
    --script=scripts/run_on_swarming_bots/cleanup_docker.py

The program will print a link which you can use to track the status of the tasks. If a subset of tasks fails (eg. bots didn't become available before the tasks timed out), you can run the program again using the --rerun flag.