tree: cc6bf7d16a076478191c79cfef1bd900d827e73e [path history] [tgz]
  1. Makefile
  2. OWNERS
  3. PRESUBMIT.py
  4. README.md
  5. app.yaml
  6. appengine_config.py
  7. cron.yaml
  8. doc/
  9. event_mon_metrics.py
  10. handlers_backend.py
  11. handlers_backend_test.py
  12. handlers_bot.py
  13. handlers_bot_test.py
  14. handlers_endpoints.py
  15. handlers_endpoints_test.py
  16. handlers_frontend.py
  17. handlers_frontend_test.py
  18. handlers_prpc.py
  19. handlers_prpc_test.py
  20. index.yaml
  21. local_smoke_test.py
  22. main_backend.py
  23. main_frontend.py
  24. mapreduce.yaml
  25. mapreduce_jobs.py
  26. message_conversion.py
  27. module-backend.yaml
  28. proto/
  29. queue.yaml
  30. remote_smoke_test.py
  31. server/
  32. setup_bigquery.sh
  33. static/
  34. swarming_bot/
  35. swarming_rpcs.py
  36. template.py
  37. templates/
  38. test_env.py
  39. test_env_handlers.py
  40. tools/
  41. ts_mon_metrics.py
  42. ts_mon_metrics_test.py
  43. ui/
  44. ui2/
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 Isolate.

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 whitelisted 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+isolate local setup with:

./tools/start_servers.py

Then run a bot with:

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