blob: ace76ce25bd0a21a7df829db2f7784babb18df21 [file] [log] [blame]
Copybara854996b2021-09-07 19:36:02 +00001# 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."""
7from __future__ import print_function
8from __future__ import division
9from __future__ import absolute_import
10
11import logging
12
13from framework import jsonfeed
14
15
Adrià Vilanova Martínezde942802022-07-15 14:06:55 +020016# TODO(https://crbug.com/monorail/6511): Convert to FlaskInternalTask
Copybara854996b2021-09-07 19:36:02 +000017class 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ínezde942802022-07-15 14:06:55 +020029 # def GetWarmup(self, **kwargs):
30 # return self.handler(**kwargs)
31
32
33# TODO(https://crbug.com/monorail/6511): Convert to FlaskInternalTask
Copybara854996b2021-09-07 19:36:02 +000034class 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ínezde942802022-07-15 14:06:55 +020046 # def GetStart(self, **kwargs):
47 # return self.handler(**kwargs)
Copybara854996b2021-09-07 19:36:02 +000048
Adrià Vilanova Martínezde942802022-07-15 14:06:55 +020049
50# TODO(https://crbug.com/monorail/6511): Convert to FlaskInternalTask
Copybara854996b2021-09-07 19:36:02 +000051class 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ínezde942802022-07-15 14:06:55 +020062
63 # def GetStop(self, **kwargs):
64 # return self.handler(**kwargs)