/usr/lib/python3/dist-packages/pyutilib/pyro/dispatch_srvr.py is in python3-pyutilib 5.3.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | #!/usr/bin/env python
import sys
from optparse import OptionParser
import pyutilib.pyro
from pyutilib.pyro import Pyro as _pyro
def main():
parser = OptionParser()
parser.add_option(
"--verbose", dest="verbose",
help="Activate verbose output.",
action="store_true", default=False)
parser.add_option(
"--max-allowed-connections", dest="max_allowed_connections",
help=("Set the maximum number of proxy connections allowed to "
"be made to this dispatcher. By default, the environment "
"variable PYUTILIB_PYRO_MAXCONNECTIONS is used if present; "
"otherwise, the default settings for Pyro or Pyro4 are used."),
type="int", default=None)
parser.add_option(
"--worker-limit", dest="worker_limit",
help=("Set the maximum number of workers allowed to register "
"with this dispatcher. By default, no limit is enforced. Note that "
"whether or not this option is set, the maximum number of possible "
"worker connections might be limited by other default Pyro settings "
"(see --max-allowed-connections)."),
type="int", default=None)
parser.add_option(
"--daemon-host", dest="daemon_host", metavar="HOST",
help="Hostname that the dispatcher daemon should bind on",
default=None)
parser.add_option(
"--daemon-port", dest="daemon_port", metavar="PORT",
help="Port that the dispatcher daemon should bind on",
type="int",
default=0)
parser.add_option(
"-n", "--host", dest="nameserver_host", metavar="HOST",
help="Hostname that the nameserver is bound on",
default=None)
parser.add_option(
"-p", "--port", dest="nameserver_port", metavar="PORT",
help="Port that the nameserver is bound on",
type="int",
default=None)
parser.add_option(
"--allow-multiple-dispatchers", dest="allow_multiple_dispatchers",
help="Allow multiple dispatchers to run under the default nameserver group",
default=False, action="store_true")
options, args = parser.parse_args()
# Handle the old syntax which was purly argument driven
# e.g., <nameserver-host> <verbose flag>
verbose = False
if len(args) == 2:
nameserver_host=sys.argv[1]
if nameserver_host == "None":
nameserver_host=None
verbose=bool(sys.argv[2])
print("DEPRECATION WARNING: dispatch_srvr is now option driven (see dispatch_srvr --help)")
elif len(args) == 1:
nameserver_host=sys.argv[1]
if nameserver_host == "None":
nameserver_host=None
print("DEPRECATION WARNING: dispatch_srvr is now option driven (see dispatch_srvr --help)")
else:
nameserver_host = options.nameserver_host
verbose = options.verbose
if _pyro is None:
raise ImportError("Pyro or Pyro4 is not available")
return pyutilib.pyro.DispatcherServer(
daemon_host=options.daemon_host,
daemon_port=options.daemon_port,
nameserver_host=nameserver_host,
nameserver_port=options.nameserver_port,
verbose=verbose,
max_allowed_connections=options.max_allowed_connections,
worker_limit=options.worker_limit,
clear_group=not options.allow_multiple_dispatchers)
if __name__ == '__main__':
main()
|