beanqueue 0.2.1__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {beanqueue-0.2.1 → beanqueue-0.2.2}/PKG-INFO +1 -1
- {beanqueue-0.2.1 → beanqueue-0.2.2}/bq/app.py +23 -1
- {beanqueue-0.2.1 → beanqueue-0.2.2}/bq/config.py +3 -0
- {beanqueue-0.2.1 → beanqueue-0.2.2}/pyproject.toml +1 -1
- {beanqueue-0.2.1 → beanqueue-0.2.2}/LICENSE +0 -0
- {beanqueue-0.2.1 → beanqueue-0.2.2}/README.md +0 -0
- {beanqueue-0.2.1 → beanqueue-0.2.2}/bq/__init__.py +0 -0
- {beanqueue-0.2.1 → beanqueue-0.2.2}/bq/cmds/__init__.py +0 -0
- {beanqueue-0.2.1 → beanqueue-0.2.2}/bq/cmds/create_tables.py +0 -0
- {beanqueue-0.2.1 → beanqueue-0.2.2}/bq/cmds/process.py +0 -0
- {beanqueue-0.2.1 → beanqueue-0.2.2}/bq/cmds/submit.py +0 -0
- {beanqueue-0.2.1 → beanqueue-0.2.2}/bq/cmds/utils.py +0 -0
- {beanqueue-0.2.1 → beanqueue-0.2.2}/bq/constants.py +0 -0
- {beanqueue-0.2.1 → beanqueue-0.2.2}/bq/db/__init__.py +0 -0
- {beanqueue-0.2.1 → beanqueue-0.2.2}/bq/db/base.py +0 -0
- {beanqueue-0.2.1 → beanqueue-0.2.2}/bq/db/session.py +0 -0
- {beanqueue-0.2.1 → beanqueue-0.2.2}/bq/events.py +0 -0
- {beanqueue-0.2.1 → beanqueue-0.2.2}/bq/models/__init__.py +0 -0
- {beanqueue-0.2.1 → beanqueue-0.2.2}/bq/models/helpers.py +0 -0
- {beanqueue-0.2.1 → beanqueue-0.2.2}/bq/models/task.py +0 -0
- {beanqueue-0.2.1 → beanqueue-0.2.2}/bq/models/worker.py +0 -0
- {beanqueue-0.2.1 → beanqueue-0.2.2}/bq/processors/__init__.py +0 -0
- {beanqueue-0.2.1 → beanqueue-0.2.2}/bq/processors/processor.py +0 -0
- {beanqueue-0.2.1 → beanqueue-0.2.2}/bq/processors/registry.py +0 -0
- {beanqueue-0.2.1 → beanqueue-0.2.2}/bq/services/__init__.py +0 -0
- {beanqueue-0.2.1 → beanqueue-0.2.2}/bq/services/dispatch.py +0 -0
- {beanqueue-0.2.1 → beanqueue-0.2.2}/bq/services/worker.py +0 -0
- {beanqueue-0.2.1 → beanqueue-0.2.2}/bq/utils.py +0 -0
|
@@ -8,6 +8,7 @@ import threading
|
|
|
8
8
|
import time
|
|
9
9
|
import typing
|
|
10
10
|
from wsgiref.simple_server import make_server
|
|
11
|
+
from wsgiref.simple_server import WSGIRequestHandler
|
|
11
12
|
|
|
12
13
|
import venusian
|
|
13
14
|
from sqlalchemy import func
|
|
@@ -31,6 +32,21 @@ from .utils import load_module_var
|
|
|
31
32
|
logger = logging.getLogger(__name__)
|
|
32
33
|
|
|
33
34
|
|
|
35
|
+
class WSGIRequestHandlerWithLogger(WSGIRequestHandler):
|
|
36
|
+
logger = logging.getLogger("metrics_server")
|
|
37
|
+
|
|
38
|
+
def log_message(self, format, *args):
|
|
39
|
+
message = format % args
|
|
40
|
+
self.logger.info(
|
|
41
|
+
"%s - - [%s] %s\n"
|
|
42
|
+
% (
|
|
43
|
+
self.address_string(),
|
|
44
|
+
self.log_date_time_string(),
|
|
45
|
+
message.translate(self._control_char_table),
|
|
46
|
+
)
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
|
|
34
50
|
class BeanQueue:
|
|
35
51
|
def __init__(
|
|
36
52
|
self,
|
|
@@ -213,7 +229,10 @@ class BeanQueue:
|
|
|
213
229
|
host = self.config.METRICS_HTTP_SERVER_INTERFACE
|
|
214
230
|
port = self.config.METRICS_HTTP_SERVER_PORT
|
|
215
231
|
with make_server(
|
|
216
|
-
host,
|
|
232
|
+
host,
|
|
233
|
+
port,
|
|
234
|
+
functools.partial(self._serve_http_request, worker_id),
|
|
235
|
+
handler_class=WSGIRequestHandlerWithLogger,
|
|
217
236
|
) as httpd:
|
|
218
237
|
logger.info("Run metrics HTTP server on %s:%s", host, port)
|
|
219
238
|
httpd.serve_forever()
|
|
@@ -255,6 +274,9 @@ class BeanQueue:
|
|
|
255
274
|
|
|
256
275
|
metrics_server_thread = None
|
|
257
276
|
if self.config.METRICS_HTTP_SERVER_ENABLED:
|
|
277
|
+
WSGIRequestHandlerWithLogger.logger.setLevel(
|
|
278
|
+
self.config.METRICS_HTTP_SERVER_LOG_LEVEL
|
|
279
|
+
)
|
|
258
280
|
metrics_server_thread = threading.Thread(
|
|
259
281
|
target=self.run_metrics_http_server,
|
|
260
282
|
args=(worker.id,),
|
|
@@ -39,6 +39,9 @@ class Config(BaseSettings):
|
|
|
39
39
|
# the metrics http server port to listen
|
|
40
40
|
METRICS_HTTP_SERVER_PORT: int = 8000
|
|
41
41
|
|
|
42
|
+
# default log level for metrics http server
|
|
43
|
+
METRICS_HTTP_SERVER_LOG_LEVEL: int = 30
|
|
44
|
+
|
|
42
45
|
POSTGRES_SERVER: str = "localhost"
|
|
43
46
|
POSTGRES_USER: str = "bq"
|
|
44
47
|
POSTGRES_PASSWORD: str = ""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|