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 | |
Adrià Vilanova Martínez | de94280 | 2022-07-15 14:06:55 +0200 | [diff] [blame] | 16 | # TODO(https://crbug.com/monorail/6511): Convert to FlaskInternalTask |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 17 | class Warmup(jsonfeed.InternalTask): |
| 18 | """Placeholder for warmup work. Used only to enable min_idle_instances.""" |
| 19 | |
| 20 | def HandleRequest(self, _mr): |
| 21 | """Don't do anything that could cause a jam when many instances start.""" |
| 22 | logging.info('/_ah/startup does nothing in Monorail.') |
| 23 | logging.info('However it is needed for min_idle_instances in app.yaml.') |
| 24 | |
| 25 | return { |
| 26 | 'success': 1, |
| 27 | } |
| 28 | |
Adrià Vilanova Martínez | de94280 | 2022-07-15 14:06:55 +0200 | [diff] [blame] | 29 | # def GetWarmup(self, **kwargs): |
| 30 | # return self.handler(**kwargs) |
| 31 | |
| 32 | |
| 33 | # TODO(https://crbug.com/monorail/6511): Convert to FlaskInternalTask |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 34 | class Start(jsonfeed.InternalTask): |
| 35 | """Placeholder for start work. Used only to enable manual_scaling.""" |
| 36 | |
| 37 | def HandleRequest(self, _mr): |
| 38 | """Don't do anything that could cause a jam when many instances start.""" |
| 39 | logging.info('/_ah/start does nothing in Monorail.') |
| 40 | logging.info('However it is needed for manual_scaling in app.yaml.') |
| 41 | |
| 42 | return { |
| 43 | 'success': 1, |
| 44 | } |
| 45 | |
Adrià Vilanova Martínez | de94280 | 2022-07-15 14:06:55 +0200 | [diff] [blame] | 46 | # def GetStart(self, **kwargs): |
| 47 | # return self.handler(**kwargs) |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 48 | |
Adrià Vilanova Martínez | de94280 | 2022-07-15 14:06:55 +0200 | [diff] [blame] | 49 | |
| 50 | # TODO(https://crbug.com/monorail/6511): Convert to FlaskInternalTask |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 51 | class Stop(jsonfeed.InternalTask): |
| 52 | """Placeholder for stop work. Used only to enable manual_scaling.""" |
| 53 | |
| 54 | def HandleRequest(self, _mr): |
| 55 | """Don't do anything that could cause a jam when many instances start.""" |
| 56 | logging.info('/_ah/stop does nothing in Monorail.') |
| 57 | logging.info('However it is needed for manual_scaling in app.yaml.') |
| 58 | |
| 59 | return { |
| 60 | 'success': 1, |
| 61 | } |
Adrià Vilanova Martínez | de94280 | 2022-07-15 14:06:55 +0200 | [diff] [blame] | 62 | |
| 63 | # def GetStop(self, **kwargs): |
| 64 | # return self.handler(**kwargs) |