Pyjoyment.Command.prethread - Pre-thread command¶
Usage: APPLICATION prethread [OPTIONS]
./myapp.py prethread
./myapp.py prethread -m production -p -l http://*:8080
./myapp.py prethread -l http://127.0.0.1:8080 -l https://[::]:8081
./myapp.py prethread -l 'https://*:443?cert=./server.crt&key=./server.key'
./myapp.py prethread -l http+unix://%2Ftmp%2Fmyapp.sock -w 12
./myapp.py prethread -l fcgi://127.0.0.1:9000
./myapp.py prethread -l http://127.0.0.1:8080 -p 127.0.0.0/8 -p fc00::/7
Options:
-a, --accepts <number> Number of connections for workers to
accept, defaults to 10000
-b, --backlog <size> Listen backlog size, defaults to
SOMAXCONN
-c, --clients <number> Maximum number of concurrent
connections, defaults to 1000
-G, --graceful-timeout <seconds> Graceful timeout, defaults to 25.
-I, --heartbeat-interval <seconds> Heartbeat interval, defaults to 5
-H, --heartbeat-timeout <seconds> Heartbeat timeout, defaults to 50
-h, --help Show this summary of available options
--home <path> Path to home directory of your
application, defaults to the value of
PYJO_HOME or auto-detection
-i, --inactivity-timeout <seconds> Inactivity timeout, defaults to the
value of PYJO_INACTIVITY_TIMEOUT or 30
-k, --keep-alive-timeout <seconds> Keep-alive timeout, defaults to the
value of PYJO_KEEP_ALIVE_TIMEOUT or 5
-l, --listen <location> One or more locations you want to
listen on, defaults to the value of
PYJO_LISTEN, the port of PORT or
"http://*:3000"
--log-format <name> Format of log messages, "text" or
"json", defaults to the value of
PYJO_LOG_FORMAT or "text"
-m, --mode <name> Operating mode for your application,
defaults to the value of PYJO_MODE or
"development"
-P, --pid-file <path> Path to process id file, defaults to
"prethread.pid" in a temporary
directory
-p, --proxy [<network>] Activate reverse proxy support,
defaults to the value of
PYJO_REVERSE_PROXY, optionally takes
one or more trusted proxy addresses or
networks
-r, --requests <number> Maximum number of requests per
keep-alive connection, defaults to 100
-s, --spare <number> Temporarily spawn up to this number of
additional workers, defaults to 2
-w, --workers <number> Number of workers, defaults to 4
Pyjoyment.Command.prethread starts applications with the
Pyjo.Server.Prethread backend, with the options of
Pyjoyment.Command.prefork.
An option that is not given has the value of the environment variable of
PYJO_ and its name, as PYJO_WORKERS for --workers, with the
values of --listen and --proxy separated by commas, see
Pyjo.GetOpt, so that the environment of a container or a platform
can tune the server.
PYJO_GRACEFUL_TIMEOUT=8 PYJO_WORKERS=2 ./myapp.py prethread
This is a core command, that means it is always enabled and its code a good example for learning to build new commands, you’re welcome to fork it.
See Pyjoyment.Commands for a list of commands that are available by
default.
See also¶
Pyjo.Server.Prethread, Pyjoyment, https://mojolicious.org.
It has no counterpart in Mojolicious; it is inspired by
Pyjoyment.Command.prefork, the counterpart of Mojolicious::Command::prefork.
Classes¶
- class Pyjoyment.Command.prethread.Pyjoyment_Command_prethread(**kwargs: Any)[source]¶
Pyjoyment.Command.prethreadinherits all attributes and methods fromPyjoyment.Command.preforkand implements the following new ones.- description = 'Start application with pre-threading HTTP and WebSocket server'¶
description = prethread.description prethread.description = 'Foo'
Short description of this command, used for the command list.
- usage = 'Usage: APPLICATION prethread [OPTIONS]\n\n ./myapp.py prethread\n ./myapp.py prethread -m production -p -l http://*:8080\n ./myapp.py prethread -l http://127.0.0.1:8080 -l https://[::]:8081\n ./myapp.py prethread -l \'https://*:443?cert=./server.crt&key=./server.key\'\n ./myapp.py prethread -l http+unix://%2Ftmp%2Fmyapp.sock -w 12\n ./myapp.py prethread -l fcgi://127.0.0.1:9000\n ./myapp.py prethread -l http://127.0.0.1:8080 -p 127.0.0.0/8 -p fc00::/7\n\nOptions:\n -a, --accepts <number> Number of connections for workers to\n accept, defaults to 10000\n -b, --backlog <size> Listen backlog size, defaults to\n SOMAXCONN\n -c, --clients <number> Maximum number of concurrent\n connections, defaults to 1000\n -G, --graceful-timeout <seconds> Graceful timeout, defaults to 25.\n -I, --heartbeat-interval <seconds> Heartbeat interval, defaults to 5\n -H, --heartbeat-timeout <seconds> Heartbeat timeout, defaults to 50\n -h, --help Show this summary of available options\n --home <path> Path to home directory of your\n application, defaults to the value of\n PYJO_HOME or auto-detection\n -i, --inactivity-timeout <seconds> Inactivity timeout, defaults to the\n value of PYJO_INACTIVITY_TIMEOUT or 30\n -k, --keep-alive-timeout <seconds> Keep-alive timeout, defaults to the\n value of PYJO_KEEP_ALIVE_TIMEOUT or 5\n -l, --listen <location> One or more locations you want to\n listen on, defaults to the value of\n PYJO_LISTEN, the port of PORT or\n "http://*:3000"\n --log-format <name> Format of log messages, "text" or\n "json", defaults to the value of\n PYJO_LOG_FORMAT or "text"\n -m, --mode <name> Operating mode for your application,\n defaults to the value of PYJO_MODE or\n "development"\n -P, --pid-file <path> Path to process id file, defaults to\n "prethread.pid" in a temporary\n directory\n -p, --proxy [<network>] Activate reverse proxy support,\n defaults to the value of\n PYJO_REVERSE_PROXY, optionally takes\n one or more trusted proxy addresses or\n networks\n -r, --requests <number> Maximum number of requests per\n keep-alive connection, defaults to 100\n -s, --spare <number> Temporarily spawn up to this number of\n additional workers, defaults to 2\n -w, --workers <number> Number of workers, defaults to 4\n'¶
usage = prethread.usage prethread.usage = 'Foo'
Usage information for this command, used for the help screen.