-
Notifications
You must be signed in to change notification settings - Fork 82
/
config.py
158 lines (119 loc) · 3.84 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# -*- coding: utf-8 -*-
from gunicorn import six
from gunicorn.config import Setting, validate_string, validate_pos_int,\
WorkerClass, validate_callable, validate_bool, validate_dict
from .six import DEFAULT_WORKER, DEFAULT_TRANSPORT, DEFAULT_PROTOCOL
WorkerClass.default = DEFAULT_WORKER
class ThriftTransportFactoryClass(Setting):
name = "thrift_transport_factory"
section = "Thrift"
cli = ["--thrift-transport-factory"]
validator = validate_string
default = DEFAULT_TRANSPORT
desc = """\
The factory class for thrift transport.
"""
class ThriftProtocolFactoryClass(Setting):
name = "thrift_protocol_factory"
section = "Thrift"
cli = ["--thrift-protocol-factory"]
validator = validate_string
default = DEFAULT_PROTOCOL
desc = """\
The factory class for thrift transport.
"""
class ThriftClientTimeout(Setting):
name = "thrift_client_timeout"
section = "Thrift"
cli = ["--thrift-client-timeout"]
validator = validate_pos_int
default = None
desc = """\
Seconds to timeout a client if client is silent after this duration
"""
class ProcessorAsFactory(Setting):
name = "thrift_processor_as_factory"
section = "Thrift"
cli = ["--thrift-processor-as-factory"]
validator = validate_bool
default = False
desc = """\
Treat app as processor factory instead of a single processor.
"""
class WorkerTerm(Setting):
name = "worker_term"
section = "Server Hooks"
validator = validate_callable(1)
type = six.callable
def worker_term(worker):
pass
default = staticmethod(worker_term)
desc = """\
Called just after a worker received SIGTERM, and about to gracefully
shutdown.
The callable needs to accept one instance variable for the initialized
Worker.
"""
class ClientConnected(Setting):
name = "on_connected"
section = "Server Hooks"
validator = validate_callable(2)
type = six.callable
def on_connected(worker, addr):
pass
default = staticmethod(on_connected)
desc = """\
Called just after a connection is made.
The callable needs to accept two instance variable for the worker and
the connected client address.
"""
class TDecodeExceptionRaised(Setting):
name = "on_tdecode_exception"
section = "Server Hooks"
validator = validate_callable(1)
type = six.callable
def on_tdecode_exception(err):
pass
default = staticmethod(on_tdecode_exception)
desc = """\
Called if tdecode exception is raised
The callable needs to accept one variable for the exception raised.
"""
class ClientConnectClosed(Setting):
name = "post_connect_closed"
section = "Server Hooks"
validator = validate_callable(1)
type = six.callable
def post_connect_closed(worker):
pass
default = staticmethod(post_connect_closed)
desc = """\
Called just after a connection is closed.
The callable needs to accept one instance variable for the worker.
"""
class ServiceRegisterConf(Setting):
name = "service_register_conf"
section = "Service Register Conf"
default = {}
validator = validate_dict
desc = """\
Config used to connect to service register watcher
"""
class ServiceRegisterClass(Setting):
name = "service_register_cls"
section = "Service Register Class"
cli = ["--service-register-cls"]
validator = validate_string
default = ''
desc = """\
The class used for register service
"""
class GeventCheckInterval(Setting):
name = "gevent_check_interval"
section = "Thrift"
cli = ["--gevent-check-interval"]
validator = validate_pos_int
default = 0
desc = """\
The inteval in which to check if gevent ioloop is blocked.
"""