| OLD | NEW |
| 1 # Copyright 2015 The LUCI Authors. All rights reserved. | 1 # Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 """GCE Backend cron jobs.""" | 5 """GCE Backend cron jobs.""" |
| 6 | 6 |
| 7 import logging | 7 import logging |
| 8 | 8 |
| 9 import webapp2 | 9 import webapp2 |
| 10 | 10 |
| 11 from components import decorators | 11 from components import decorators |
| 12 | 12 |
| 13 import catalog | 13 import catalog |
| 14 import cleanup | 14 import cleanup |
| 15 import config | 15 import config |
| 16 import instance_group_managers | 16 import instance_group_managers |
| 17 import instance_templates | 17 import instance_templates |
| 18 import instances | 18 import instances |
| 19 import metadata | 19 import metadata |
| 20 import parse | 20 import parse |
| 21 import pubsub | |
| 22 | 21 |
| 23 | 22 |
| 24 class CatalogedInstanceRemovalHandler(webapp2.RequestHandler): | 23 class CatalogedInstanceRemovalHandler(webapp2.RequestHandler): |
| 25 """Worker for removing cataloged instances.""" | 24 """Worker for removing cataloged instances.""" |
| 26 | 25 |
| 27 @decorators.require_cronjob | 26 @decorators.require_cronjob |
| 28 def get(self): | 27 def get(self): |
| 29 catalog.schedule_removal() | 28 catalog.schedule_removal() |
| 30 | 29 |
| 31 | 30 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 152 |
| 154 | 153 |
| 155 class MetadataTaskScheduleHandler(webapp2.RequestHandler): | 154 class MetadataTaskScheduleHandler(webapp2.RequestHandler): |
| 156 """Worker for scheduling metadata tasks.""" | 155 """Worker for scheduling metadata tasks.""" |
| 157 | 156 |
| 158 @decorators.require_cronjob | 157 @decorators.require_cronjob |
| 159 def get(self): | 158 def get(self): |
| 160 metadata.schedule_metadata_tasks() | 159 metadata.schedule_metadata_tasks() |
| 161 | 160 |
| 162 | 161 |
| 163 class PubSubMessageProcessHandler(webapp2.RequestHandler): | |
| 164 """Worker for processing Pub/Sub messages.""" | |
| 165 | |
| 166 @decorators.require_cronjob | |
| 167 def get(self): | |
| 168 pubsub.schedule_poll() | |
| 169 | |
| 170 | |
| 171 def create_cron_app(): | 162 def create_cron_app(): |
| 172 return webapp2.WSGIApplication([ | 163 return webapp2.WSGIApplication([ |
| 173 ('/internal/cron/catalog-instances', InstanceCatalogHandler), | 164 ('/internal/cron/catalog-instances', InstanceCatalogHandler), |
| 174 ('/internal/cron/cleanup-entities', EntityCleanupHandler), | 165 ('/internal/cron/cleanup-entities', EntityCleanupHandler), |
| 175 ('/internal/cron/create-instance-group-managers', | 166 ('/internal/cron/create-instance-group-managers', |
| 176 InstanceGroupManagerCreationHandler), | 167 InstanceGroupManagerCreationHandler), |
| 177 ('/internal/cron/create-instance-templates', | 168 ('/internal/cron/create-instance-templates', |
| 178 InstanceTemplateCreationHandler), | 169 InstanceTemplateCreationHandler), |
| 179 ('/internal/cron/delete-drained-instances', | 170 ('/internal/cron/delete-drained-instances', |
| 180 DrainedInstancesDeletionHandler), | 171 DrainedInstancesDeletionHandler), |
| 181 ('/internal/cron/delete-instance-group-managers', | 172 ('/internal/cron/delete-instance-group-managers', |
| 182 InstanceGroupManagerDeletionHandler), | 173 InstanceGroupManagerDeletionHandler), |
| 183 ('/internal/cron/delete-instances-pending-deletion', | 174 ('/internal/cron/delete-instances-pending-deletion', |
| 184 InstancesPendingDeletionDeletionHandler), | 175 InstancesPendingDeletionDeletionHandler), |
| 185 ('/internal/cron/delete-instance-templates', | 176 ('/internal/cron/delete-instance-templates', |
| 186 InstanceTemplateDeletionHandler), | 177 InstanceTemplateDeletionHandler), |
| 187 ('/internal/cron/delete-instances', InstanceDeletionHandler), | 178 ('/internal/cron/delete-instances', InstanceDeletionHandler), |
| 188 ('/internal/cron/fetch-instances', InstanceFetchHandler), | 179 ('/internal/cron/fetch-instances', InstanceFetchHandler), |
| 189 ('/internal/cron/import-config', ConfigImportHandler), | 180 ('/internal/cron/import-config', ConfigImportHandler), |
| 190 ('/internal/cron/process-config', ConfigProcessHandler), | 181 ('/internal/cron/process-config', ConfigProcessHandler), |
| 191 ('/internal/cron/process-pubsub-messages', PubSubMessageProcessHandler), | |
| 192 ('/internal/cron/remove-cataloged-instances', | 182 ('/internal/cron/remove-cataloged-instances', |
| 193 CatalogedInstanceRemovalHandler), | 183 CatalogedInstanceRemovalHandler), |
| 194 ('/internal/cron/resize-instance-groups', InstanceGroupResizeHandler), | 184 ('/internal/cron/resize-instance-groups', InstanceGroupResizeHandler), |
| 195 ('/internal/cron/update-cataloged-instances', | 185 ('/internal/cron/update-cataloged-instances', |
| 196 CatalogedInstanceUpdateHandler), | 186 CatalogedInstanceUpdateHandler), |
| 197 ('/internal/cron/schedule-metadata-tasks', MetadataTaskScheduleHandler), | 187 ('/internal/cron/schedule-metadata-tasks', MetadataTaskScheduleHandler), |
| 198 ]) | 188 ]) |
| OLD | NEW |