Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1744)

Unified Diff: appengine/machine_provider/main.py

Issue 2225263004: Adds config component to Machine Provider (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master
Patch Set: . Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/machine_provider/handlers_endpoints.py ('k') | appengine/machine_provider/proto/Makefile » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/machine_provider/main.py
diff --git a/appengine/machine_provider/main.py b/appengine/machine_provider/main.py
index 5ed2f39f7379125bf1fdda1ad178c51352edbcfc..a622b0a989d7fdaeea59d02324b4015f64df0650 100644
--- a/appengine/machine_provider/main.py
+++ b/appengine/machine_provider/main.py
@@ -8,19 +8,29 @@ from components import utils
import gae_ts_mon
+import config
import handlers_cron
import handlers_endpoints
import handlers_frontend
import handlers_queues
-utils.set_task_queue_module('default')
+def is_enabled_callback():
+ return config.settings().enable_ts_monitoring
-cron_app = handlers_cron.create_cron_app()
-endpoints_app = handlers_endpoints.create_endpoints_app()
-frontend_app = handlers_frontend.create_frontend_app()
-queue_app = handlers_queues.create_queues_app()
-gae_ts_mon.initialize(app=cron_app)
-gae_ts_mon.initialize(app=frontend_app)
-gae_ts_mon.initialize(app=queue_app)
+def main():
+ utils.set_task_queue_module('default')
+ apps = (
+ handlers_endpoints.create_endpoints_app(),
+ handlers_cron.create_cron_app(),
+ handlers_frontend.create_frontend_app(),
+ handlers_queues.create_queues_app(),
+ )
+ for app in apps[1:]:
+ # Not callable on endpoints app
+ gae_ts_mon.initialize(app=app, is_enabled_fn=is_enabled_callback)
+ return apps
+
+
+endpoints_app, cron_app, frontend_app, queue_app = main()
« no previous file with comments | « appengine/machine_provider/handlers_endpoints.py ('k') | appengine/machine_provider/proto/Makefile » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698