Scroll to navigation

PORTSERVER.PY(1) User Commands PORTSERVER.PY(1)

NAME

portserver.py - server to hand out unused port numbers

DESCRIPTION

usage: portserver.py [-h] [--portserver_static_pool PORTSERVER_STATIC_POOL]

[--portserver_address PORTSERVER_ADDRESS] [--verbose]
[--debug]

options:

show this help message and exit
Comma separated N-P Range(s) of ports to manage (inclusive).
Address of AF_UNIX socket on which to listen on Unix (first @ is a NUL) or the name of the pipe on Windows (first @ is the \\.\pipe\ prefix).
Enable verbose messages.
Enable full debug messages.

PORT SERVER

A port server is intended to be run as a daemon, for use by all processes running on the host. It coordinates uses of network ports by anything using a portpicker library. If you are using hosts as part of a test automation cluster, each one should run a port server as a daemon. You should set the PORTSERVER_ADDRESS=@unittest-portserver environment variable on all of your test runners so that portpicker makes use of it.

A port server listens on a unix socket, reads a pid from a new connection, tests the ports it is managing and replies with a port assignment port for that pid. A port is only reclaimed for potential reassignment to another process after the process it was originally assigned to has died. Processes that need multiple ports can simply issue multiple requests and are guaranteed they will each be unique.

TYPICAL USAGE


1) Run one instance of this process on each of your unittest farm hosts.
2) Set the PORTSERVER_ADDRESS environment variable in your test runner
environment to let the portpicker library know to use a port server
rather than attempt to find ports on its own.


$ /path/to/portserver.py &
$ export PORTSERVER_ADDRESS=@unittest-portserver
$ # ... launch a bunch of unittest runners using portpicker ...

October 2024 portserver.py 1.6.0