threadmill 0.7.2__tar.gz → 0.7.3__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.
- {threadmill-0.7.2 → threadmill-0.7.3}/PKG-INFO +1 -1
- {threadmill-0.7.2 → threadmill-0.7.3}/threadmill/_version.py +3 -3
- {threadmill-0.7.2 → threadmill-0.7.3}/threadmill/executor.py +17 -5
- {threadmill-0.7.2 → threadmill-0.7.3}/threadmill/management/commands/threadmill.py +2 -2
- {threadmill-0.7.2 → threadmill-0.7.3}/LICENSE +0 -0
- {threadmill-0.7.2 → threadmill-0.7.3}/README.md +0 -0
- {threadmill-0.7.2 → threadmill-0.7.3}/pyproject.toml +0 -0
- {threadmill-0.7.2 → threadmill-0.7.3}/threadmill/__init__.py +0 -0
- {threadmill-0.7.2 → threadmill-0.7.3}/threadmill/apps.py +0 -0
- {threadmill-0.7.2 → threadmill-0.7.3}/threadmill/backends/__init__.py +0 -0
- {threadmill-0.7.2 → threadmill-0.7.3}/threadmill/backends/base.py +0 -0
- {threadmill-0.7.2 → threadmill-0.7.3}/threadmill/backends/lua/acknowledge.lua +0 -0
- {threadmill-0.7.2 → threadmill-0.7.3}/threadmill/backends/lua/acquire.lua +0 -0
- {threadmill-0.7.2 → threadmill-0.7.3}/threadmill/backends/lua/mover.lua +0 -0
- {threadmill-0.7.2 → threadmill-0.7.3}/threadmill/backends/lua/reaper.lua +0 -0
- {threadmill-0.7.2 → threadmill-0.7.3}/threadmill/backends/redis.py +0 -0
- {threadmill-0.7.2 → threadmill-0.7.3}/threadmill/exceptions.py +0 -0
- {threadmill-0.7.2 → threadmill-0.7.3}/threadmill/inspector/__init__.py +0 -0
- {threadmill-0.7.2 → threadmill-0.7.3}/threadmill/inspector/app.py +0 -0
- {threadmill-0.7.2 → threadmill-0.7.3}/threadmill/inspector/inspector.scss +0 -0
- {threadmill-0.7.2 → threadmill-0.7.3}/threadmill/inspector/screens.py +0 -0
- {threadmill-0.7.2 → threadmill-0.7.3}/threadmill/inspector/telemetry.py +0 -0
- {threadmill-0.7.2 → threadmill-0.7.3}/threadmill/management/__init__.py +0 -0
- {threadmill-0.7.2 → threadmill-0.7.3}/threadmill/management/commands/__init__.py +0 -0
- {threadmill-0.7.2 → threadmill-0.7.3}/threadmill/retry.py +0 -0
- {threadmill-0.7.2 → threadmill-0.7.3}/threadmill/signals.py +0 -0
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '0.7.
|
|
22
|
-
__version_tuple__ = version_tuple = (0, 7,
|
|
21
|
+
__version__ = version = '0.7.3'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 7, 3)
|
|
23
23
|
|
|
24
|
-
__commit_id__ = commit_id = '
|
|
24
|
+
__commit_id__ = commit_id = 'g0eee0b8b7'
|
|
@@ -8,6 +8,7 @@ import logging
|
|
|
8
8
|
import multiprocessing
|
|
9
9
|
import random
|
|
10
10
|
import socket
|
|
11
|
+
import sys
|
|
11
12
|
import threading
|
|
12
13
|
import time
|
|
13
14
|
import typing
|
|
@@ -81,10 +82,21 @@ class JsonFormatter(logging.Formatter):
|
|
|
81
82
|
|
|
82
83
|
|
|
83
84
|
logger = multiprocessing.get_logger()
|
|
84
|
-
handler = logging.StreamHandler()
|
|
85
|
+
handler = logging.StreamHandler(sys.stdout)
|
|
85
86
|
handler.setFormatter(JsonFormatter())
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def configure_logging(formatter: logging.Formatter) -> None:
|
|
90
|
+
"""Route every log record of this process through the threadmill handler."""
|
|
91
|
+
handler.setFormatter(formatter)
|
|
92
|
+
for existing_logger in logging.root.manager.loggerDict.values():
|
|
93
|
+
if isinstance(existing_logger, logging.Logger):
|
|
94
|
+
existing_logger.handlers.clear()
|
|
95
|
+
existing_logger.propagate = True
|
|
96
|
+
root_logger = logging.getLogger()
|
|
97
|
+
root_logger.handlers.clear()
|
|
98
|
+
root_logger.addHandler(handler)
|
|
99
|
+
root_logger.setLevel(logging.INFO)
|
|
88
100
|
|
|
89
101
|
|
|
90
102
|
@dataclasses.dataclass(kw_only=True, slots=True)
|
|
@@ -138,7 +150,7 @@ class TaskExecutor:
|
|
|
138
150
|
|
|
139
151
|
def run(self) -> None:
|
|
140
152
|
"""Start consuming tasks until shutdown is requested."""
|
|
141
|
-
|
|
153
|
+
configure_logging(self.log_formatter)
|
|
142
154
|
self.worker_processes = [
|
|
143
155
|
self.create_worker_process() for _ in range(self.process_count)
|
|
144
156
|
]
|
|
@@ -213,8 +225,8 @@ class WorkerProcess(multiprocessing.Process):
|
|
|
213
225
|
|
|
214
226
|
def run(self) -> None:
|
|
215
227
|
"""Start consumer execution inside this process."""
|
|
216
|
-
handler.setFormatter(self.log_formatter)
|
|
217
228
|
django.setup()
|
|
229
|
+
configure_logging(self.log_formatter)
|
|
218
230
|
logger.info("Starting worker process %s", self.name)
|
|
219
231
|
self.lock = threading.Lock()
|
|
220
232
|
self.expired = threading.Event()
|
|
@@ -88,8 +88,8 @@ class WorkerCommand(DjangoBaseCommand):
|
|
|
88
88
|
parser.add_argument(
|
|
89
89
|
"--log-format",
|
|
90
90
|
help=(
|
|
91
|
-
"Logging format string for
|
|
92
|
-
" '%%(levelname)s %%(message)s'. Defaults to JSON."
|
|
91
|
+
"Logging format string for all log records of the worker process,"
|
|
92
|
+
" e.g. '%%(levelname)s %%(message)s'. Defaults to JSON."
|
|
93
93
|
),
|
|
94
94
|
)
|
|
95
95
|
|
|
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
|