tree: 42a8c9571430ca9268684be9a864483a5fa88f7f [path history] [tgz]
  1. bb/
  2. doc/
  3. proto/
  4. server/
  5. static/
  6. swarming_bot/
  7. templates/
  8. tools/
  9. ui2/
  10. api_common.py
  11. api_common_test.py
  12. api_helpers.py
  13. api_helpers_test.py
  14. app.yaml
  15. appengine_config.py
  16. backend_conversions.py
  17. backend_conversions_test.py
  18. handlers_backend.py
  19. handlers_backend_test.py
  20. handlers_bot.py
  21. handlers_bot_test.py
  22. handlers_endpoints.py
  23. handlers_endpoints_test.py
  24. handlers_exceptions.py
  25. handlers_frontend.py
  26. handlers_frontend_test.py
  27. handlers_prpc.py
  28. handlers_prpc_test.py
  29. handlers_task_backend.py
  30. handlers_task_backend_test.py
  31. index.yaml
  32. local_smoke_testing.py
  33. main_backend.py
  34. main_frontend.py
  35. Makefile
  36. message_conversion.py
  37. message_conversion_prpc.py
  38. message_conversion_prpc_test.py
  39. message_conversion_test.py
  40. OWNERS
  41. PRESUBMIT.py
  42. prpc_helpers.py
  43. prpc_helpers_test.py
  44. queue.yaml
  45. README.md
  46. service-backend.yaml
  47. setup_bigquery.sh
  48. swarming_rpcs.py
  49. swarming_test_env.py
  50. template.py
  51. test.py
  52. test_env_handlers.py
  53. ts_mon_metrics.py
  54. ts_mon_metrics_test.py
  55. unittest.cfg
appengine/swarming/README.md

Swarming

An AppEngine service to do task scheduling on highly hetegeneous fleets at medium (10000s) scale. It is focused to survive network with low reliability, high latency while still having low bot maintenance, and no server maintenance at all since it's running on AppEngine.

Swarming is purely a task scheduler service. File I/O is done through RBE-CAS (google internal) .

Documentation

Chrome Operations release

Visit https://goto.google.com/swarming-releases for the Chrome Operations release process.

Setting up

  • Visit http://console.cloud.google.com and create a project. Replace <appid> below with your project id.
    • App Engine
      • Enable it and choose us-central.
    • IAM & Admin > IAM
      • Click Add Member and add someone else so you can safely be hit by a bus.
    • APIs & Services > Credentials
      • Create a new OAuth client ID.
      • Click Configure consent screen if required.
        • Use the Swarming LUCY mascot.
        • Set Authorized domains to <appid>.appspot.com
        • Set Application Homepage link and Privacy Policy link to https://<appid>.appspot.com.
        • Click Save. You need to create the token before requesting validation...
      • Choose Application type Web application.
      • Set Authorized JavaScript origins to https://<appid>.appspot.com.
      • Set Authorized redirect URIs to https://<appid>.appspot.com/oauth2callback.
      • Click Create.
      • Replace <client_id> below with the created client id.
    • Pub/Sub
      • Click Enable API.
    • App Engine > Memcache
      • Click Change.
      • Chose Dedicated.
      • Set the cache to Dedicated 1Gb.
      • Wait a day of steady state usage.
      • Set the limit to be lower than the value read at “Total cache size” in “Memcache Viewer”.
    • App Engine > Settings
      • Click Edit:
      • Set Google login Cookie expiration to: 2 weeks.
      • Click Save.
  • Upload the code with: ./tools/gae upl -x -A <appid>
  • Run setup_bigquery.sh to create the BigQuery swarming.* tables and grant write access to the AppEngine app. The cron job will fail meanwhile.
  • If you plan to use a config service (the normal case):
  • If you are not using a config service, see Configuring using FS mode.
    • You'll need to add an entry to settings.cfg like ui_client_id: "<client_id>"
    • You also need to update chrome-infra-auth/oauth.cfg to add client_ids: "<client_id>"
  • If you plan to use an auth_service,
  • Else, visit https://<appid>.appspot.com/auth/bootstrap and click Proceed.
  • Visit “https://<appid>.appspot.com/auth/groups”:
  • Configure bot_config.py and bootstrap.py as desired. Both are optional.
  • Visit “https://<appid>.appspot.com” and follow the instructions to start a bot.
  • Visit “https://<appid>.appspot.com/botlist” to ensure the bot is alive.
  • Run one of the examples in the client code.

Running locally

You still need an OAuth2 client id if you want to use the Web UI:

  • Visit http://console.cloud.google.com and create a project.

  • Visit Google Cloud Console

    • APIs & Services > Credentials
      • Create a new “Oauth 2.0 Client Id” of type “web application”. Make sure http://localhost:9050 is an authorized JavaScript origin and http://localhost:9050/oauth2callback is an authorized redirect URL. You can add multiple ports as needed. 9050 is the default port used by start_server.py. Replace <client_id> below with the created client id. It will look like 012345678901-abcdefghijklmnopqrstuvwxyzabcdef.apps.googleusercontent.com.
      • You will have to do the ‘consent’ flow.
  • Configure to use this client ID using FS mode. Create configs/services/swarming-local/CONFIGS/settings.cfg with:

      mkdir -p configs/services/swarming-local/CONFIGS/
      echo 'ui_client_id: "<client_id>"' > configs/services/swarming-local/CONFIGS/settings.cfg
    
  • If you want to access it from another workstation, since the cliend id is allowed to localhost, you can ssh workstation -L 9050:localhost:9050. Make sure that any corp proxy is bypassed as needed.

You can run a swarming+RBE-CAS local setup with:

./tools/start_servers.py

Then run a bot with:

./tools/start_bot.py http://localhost:9050