Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame^] | 1 | # Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style |
| 3 | # license that can be found in the LICENSE file or at |
| 4 | # https://developers.google.com/open-source/licenses/bsd |
| 5 | |
| 6 | """A class to handle the initial warmup request from AppEngine.""" |
| 7 | from __future__ import print_function |
| 8 | from __future__ import division |
| 9 | from __future__ import absolute_import |
| 10 | |
| 11 | import logging |
| 12 | |
| 13 | from framework import jsonfeed |
| 14 | |
| 15 | |
| 16 | class Warmup(jsonfeed.InternalTask): |
| 17 | """Placeholder for warmup work. Used only to enable min_idle_instances.""" |
| 18 | |
| 19 | def HandleRequest(self, _mr): |
| 20 | """Don't do anything that could cause a jam when many instances start.""" |
| 21 | logging.info('/_ah/startup does nothing in Monorail.') |
| 22 | logging.info('However it is needed for min_idle_instances in app.yaml.') |
| 23 | |
| 24 | return { |
| 25 | 'success': 1, |
| 26 | } |
| 27 | |
| 28 | class Start(jsonfeed.InternalTask): |
| 29 | """Placeholder for start work. Used only to enable manual_scaling.""" |
| 30 | |
| 31 | def HandleRequest(self, _mr): |
| 32 | """Don't do anything that could cause a jam when many instances start.""" |
| 33 | logging.info('/_ah/start does nothing in Monorail.') |
| 34 | logging.info('However it is needed for manual_scaling in app.yaml.') |
| 35 | |
| 36 | return { |
| 37 | 'success': 1, |
| 38 | } |
| 39 | |
| 40 | |
| 41 | class Stop(jsonfeed.InternalTask): |
| 42 | """Placeholder for stop work. Used only to enable manual_scaling.""" |
| 43 | |
| 44 | def HandleRequest(self, _mr): |
| 45 | """Don't do anything that could cause a jam when many instances start.""" |
| 46 | logging.info('/_ah/stop does nothing in Monorail.') |
| 47 | logging.info('However it is needed for manual_scaling in app.yaml.') |
| 48 | |
| 49 | return { |
| 50 | 'success': 1, |
| 51 | } |