Skip to content

Commit 6e7ee0e

Browse files
authored
[gunicorn] Update to 25.1.0 (#15425)
1 parent da3de3a commit 6e7ee0e

File tree

13 files changed

+325
-16
lines changed

13 files changed

+325
-16
lines changed

stubs/gunicorn/METADATA.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "25.0.3"
1+
version = "25.1.0"
22
upstream_repository = "https://github.com/benoitc/gunicorn"
33
requires = ["types-gevent"]
44

stubs/gunicorn/gunicorn/config.pyi

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,3 +1283,31 @@ class DirtyWorkerExit(Setting):
12831283
desc: ClassVar[str]
12841284

12851285
def dirty_worker_exit(arbiter: Arbiter, worker: Worker) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
1286+
1287+
class ControlSocket(Setting):
1288+
name: ClassVar[str]
1289+
section: ClassVar[str]
1290+
cli: ClassVar[list[str]]
1291+
meta: ClassVar[str]
1292+
validator: ClassVar[_StringValidatorType]
1293+
default: ClassVar[str]
1294+
desc: ClassVar[str]
1295+
1296+
class ControlSocketMode(Setting):
1297+
name: ClassVar[str]
1298+
section: ClassVar[str]
1299+
cli: ClassVar[list[str]]
1300+
meta: ClassVar[str]
1301+
validator: ClassVar[_IntValidatorType]
1302+
type: ClassVar[Callable[[Any, str], int]]
1303+
default: ClassVar[int]
1304+
desc: ClassVar[str]
1305+
1306+
class ControlSocketDisable(Setting):
1307+
name: ClassVar[str]
1308+
section: ClassVar[str]
1309+
cli: ClassVar[list[str]]
1310+
validator: ClassVar[_BoolValidatorType]
1311+
action: ClassVar[str]
1312+
default: ClassVar[bool]
1313+
desc: ClassVar[str]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from gunicorn.ctl.client import ControlClient as ControlClient
2+
from gunicorn.ctl.protocol import ControlProtocol as ControlProtocol
3+
from gunicorn.ctl.server import ControlSocketServer as ControlSocketServer
4+
5+
__all__ = ["ControlSocketServer", "ControlClient", "ControlProtocol"]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from _typeshed import Incomplete
2+
3+
def format_workers(data: dict[str, Incomplete]) -> str: ...
4+
def format_dirty(data: dict[str, Incomplete]) -> str: ...
5+
def format_stats(data: dict[str, Incomplete]) -> str: ...
6+
def format_listeners(data: dict[str, Incomplete]) -> str: ...
7+
def format_config(data: dict[str, Incomplete]) -> str: ...
8+
def format_help(data: dict[str, Incomplete]) -> str: ...
9+
def format_all(data: dict[str, Incomplete]) -> str: ...
10+
def format_response(command: str, data: dict[str, Incomplete]) -> str: ...
11+
def run_command(socket_path: str, command: str, json_output: bool = False) -> int: ...
12+
def run_interactive(socket_path: str, json_output: bool = False) -> int: ...
13+
def main() -> int: ...
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from _typeshed import Incomplete, Unused
2+
from typing_extensions import Self
3+
4+
class ControlClientError(Exception): ...
5+
6+
class ControlClient:
7+
socket_path: str
8+
timeout: float
9+
def __init__(self, socket_path: str, timeout: float = 30.0) -> None: ...
10+
def connect(self) -> None: ...
11+
def close(self) -> None: ...
12+
def send_command(self, command: str, args: list[str] | None = None) -> dict[Incomplete, Incomplete]: ...
13+
def __enter__(self) -> Self: ...
14+
def __exit__(self, *args: Unused) -> None: ...
15+
16+
def parse_command(line: str) -> tuple[str, list[str]]: ...
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from _typeshed import Incomplete
2+
3+
from gunicorn.arbiter import Arbiter
4+
5+
class CommandHandlers:
6+
arbiter: Arbiter
7+
def __init__(self, arbiter: Arbiter) -> None: ...
8+
# TODO: Use TypedDict for next return types
9+
def show_workers(self) -> dict[str, Incomplete]: ...
10+
def show_dirty(self) -> dict[str, Incomplete]: ...
11+
def show_config(self) -> dict[str, Incomplete]: ...
12+
def show_stats(self) -> dict[str, Incomplete]: ...
13+
def show_listeners(self) -> dict[str, Incomplete]: ...
14+
def worker_add(self, count: int = 1) -> dict[str, Incomplete]: ...
15+
def worker_remove(self, count: int = 1) -> dict[str, Incomplete]: ...
16+
def worker_kill(self, pid: int) -> dict[str, Incomplete]: ...
17+
def dirty_add(self, count: int = 1) -> dict[str, Incomplete]: ...
18+
def dirty_remove(self, count: int = 1) -> dict[str, Incomplete]: ...
19+
def reload(self) -> dict[str, Incomplete]: ...
20+
def reopen(self) -> dict[str, Incomplete]: ...
21+
def shutdown(self, mode: str = "graceful") -> dict[str, Incomplete]: ...
22+
def show_all(self) -> dict[str, Incomplete]: ...
23+
def help(self) -> dict[str, Incomplete]: ...
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from _typeshed import Incomplete
2+
from asyncio import StreamReader, StreamWriter
3+
from socket import socket
4+
from typing import ClassVar
5+
6+
class ProtocolError(Exception): ...
7+
8+
class ControlProtocol:
9+
MAX_MESSAGE_SIZE: ClassVar[int]
10+
@staticmethod
11+
def encode_message(data: dict[Incomplete, Incomplete]) -> bytes: ...
12+
@staticmethod
13+
def decode_message(data: bytes) -> dict[Incomplete, Incomplete]: ...
14+
@staticmethod
15+
def read_message(sock: socket) -> dict[Incomplete, Incomplete]: ...
16+
@staticmethod
17+
def write_message(sock: socket, data: dict[Incomplete, Incomplete]) -> None: ...
18+
@staticmethod
19+
async def read_message_async(reader: StreamReader) -> dict[Incomplete, Incomplete]: ...
20+
@staticmethod
21+
async def write_message_async(writer: StreamWriter, data: dict[Incomplete, Incomplete]) -> None: ...
22+
23+
# TODO: Use TypedDict for next return types
24+
def make_request(request_id: int, command: str, args: list[str] | None = None) -> dict[str, Incomplete]: ...
25+
def make_response(request_id: int, data: dict[Incomplete, Incomplete] | None = None) -> dict[str, Incomplete]: ...
26+
def make_error_response(request_id: int, error: str) -> dict[str, Incomplete]: ...
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from gunicorn.arbiter import Arbiter
2+
from gunicorn.ctl.handlers import CommandHandlers
3+
4+
class ControlSocketServer:
5+
arbiter: Arbiter
6+
socket_path: str
7+
socket_mode: int
8+
handlers: CommandHandlers
9+
def __init__(self, arbiter: Arbiter, socket_path: str, socket_mode: int = 0o600) -> None: ...
10+
def start(self) -> None: ...
11+
def stop(self) -> None: ...

stubs/gunicorn/gunicorn/dirty/__init__.pyi

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from . import stash as stash
12
from .app import DirtyApp as DirtyApp
23
from .arbiter import DirtyArbiter as DirtyArbiter
34
from .client import (
@@ -17,6 +18,13 @@ from .errors import (
1718
DirtyTimeoutError as DirtyTimeoutError,
1819
DirtyWorkerError as DirtyWorkerError,
1920
)
21+
from .stash import (
22+
StashClient as StashClient,
23+
StashError as StashError,
24+
StashKeyNotFoundError as StashKeyNotFoundError,
25+
StashTable as StashTable,
26+
StashTableNotFoundError as StashTableNotFoundError,
27+
)
2028

2129
__all__ = [
2230
"DirtyError",
@@ -32,6 +40,12 @@ __all__ = [
3240
"get_dirty_client_async",
3341
"close_dirty_client",
3442
"close_dirty_client_async",
43+
"stash",
44+
"StashClient",
45+
"StashTable",
46+
"StashError",
47+
"StashTableNotFoundError",
48+
"StashKeyNotFoundError",
3549
"DirtyArbiter",
3650
"set_dirty_socket_path",
3751
]

stubs/gunicorn/gunicorn/dirty/arbiter.pyi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,22 @@ class DirtyArbiter:
2525
worker_consumers: dict[int, asyncio.Task[None]]
2626
worker_age: int
2727
alive: bool
28+
num_workers: int
2829
app_specs: dict[str, dict[Incomplete, Incomplete]]
2930
app_worker_map: dict[str, set[Incomplete]]
3031
worker_app_map: dict[int, list[Incomplete]]
32+
stash_tables: dict[str, dict[Incomplete, Incomplete]]
3133

3234
def __init__(self, cfg: Config, log: GLogger, socket_path: str | None = None, pidfile: str | None = None) -> None: ...
3335
def run(self) -> None: ...
3436
def init_signals(self) -> None: ...
3537
async def handle_client(self, reader: StreamReader, writer: StreamWriter) -> None: ...
3638
async def route_request(self, request: dict[str, Incomplete], client_writer: StreamWriter) -> None: ...
39+
async def handle_status_request(self, message: dict[str, Incomplete], client_writer: StreamWriter) -> None: ...
40+
async def handle_manage_request(self, message: dict[str, Incomplete], client_writer: StreamWriter) -> None: ...
41+
async def handle_stash_request(self, message: dict[str, Incomplete], client_writer: StreamWriter) -> None: ...
3742
async def manage_workers(self) -> None: ...
38-
def spawn_worker(self) -> int | None: ...
43+
def spawn_worker(self, force_all_apps: bool = False) -> int | None: ...
3944
def kill_worker(self, pid: int, sig: int) -> None: ...
4045
async def murder_workers(self) -> None: ...
4146
def reap_workers(self) -> None: ...

0 commit comments

Comments
 (0)