示例#1
0
def setup_options():
	parser = dwconfig.setup_options("%prog [--help] [options] CONF-FILE",
					"dwiki-cgi 0.1")
	parser.add_option('-N', '--null-app', dest='nullapp',
			  action="store_true", help="run a null application")
	parser.set_defaults(nullapp=False)
	return parser
示例#2
0
def setup_options():
    parser = dwconfig.setup_options("%prog [--help] [options] CONFIG URL COUNT [RENDERER]", "testbench 0.1")
    parser.add_option(
        "-B",
        "--no-bfc",
        dest="rmconfig",
        action="append_const",
        const="bfc-cache-ttl",
        help="disable the Brute Force Cache",
    )
    parser.add_option(
        "-I",
        "--no-imc",
        dest="rmconfig",
        action="append_const",
        const="imc-cache-entries",
        help="disable the In Memory Cache",
    )
    parser.add_option(
        "-6",
        "--ipv6-origin",
        dest="ip6origin",
        action="store_true",
        help="make requests appear to come from the IPv6 localhost address instead of the IPv4 one",
    )
    parser.add_option(
        "-W",
        "--warmup-count",
        dest="prerun",
        action="store",
        type="int",
        help="make this many requests as an untimed warmup",
    )
    parser.add_option(
        "-P",
        "--profile",
        dest="operation",
        action="store_const",
        const=doProfile,
        help="profile, using the Python profiler",
    )
    parser.add_option(
        "-S",
        "--statprof",
        dest="operation",
        action="store_const",
        const=doStatProf,
        help="profile, using the statistical profiler",
    )
    parser.set_defaults(operation=doTime, ip6origin=False, prerun=0)
    return parser
示例#3
0
def setup_options():
    parser = dwconfig.setup_options(
        "%prog [--help] [options] CONFIG HOSTNAME URL [URL ...]",
        "dwiki-cache 0.1")
    parser.add_option(
        '-P',
        '--port',
        dest='port',
        action="store",
        type="string",
        help="set the server port for the requests, default %default.")
    parser.add_option("-S",
                      "--https",
                      dest="scheme",
                      action="store_const",
                      const="https",
                      help="pretend the request used HTTPS instead of HTTP.")
    parser.set_defaults(port="80", scheme="http")

    return parser
示例#4
0
def setup_options():
    parser = dwconfig.setup_options("%prog [--help] [options] CONFIG HOSTNAME URL [URL ...]", "dwiki-cache 0.1")
    parser.add_option(
        "-P",
        "--port",
        dest="port",
        action="store",
        type="string",
        help="set the server port for the requests, default %default.",
    )
    parser.add_option(
        "-S",
        "--https",
        dest="scheme",
        action="store_const",
        const="https",
        help="pretend the request used HTTPS instead of HTTP.",
    )
    parser.set_defaults(port="80", scheme="http")

    return parser
示例#5
0
def setup_options():
	parser = dwconfig.setup_options("%prog [--help] [options] CONF-FILE",
					"dwiki-serv 0.1")
	parser.add_option('-f', '--fork', dest="servtype",
			  action="store_const", const="fork",
			  help="server forks to handle each connection")
	parser.add_option('-t', '--thread', dest="servtype",
			  action="store_const", const="thread",
			  help="server spawns a thread to handle connections")
	parser.add_option('-s', '--serial', dest="servtype",
			  action="store_const", const="plain",
			  help="server handles connections serially")
	parser.add_option('-c', '--count', dest="howmany",
			  action="store", type="int", metavar="COUNT",
			  help="run the server for only COUNT requests")
	parser.add_option('-P', '--profile', dest="profile",
			  action="store_true", help="profile the execution.")
	parser.add_option('-p', '--port', type="int", metavar="PORT",
			  dest="port", help="listen on port PORT (default %default)")
	parser.add_option('-a', '--address', type="string", metavar="ADDR",
			  dest="addr", help="listen only at IP address ADDR")
	parser.set_defaults(servtype = "default", howmany= -1, profile=False,
			    port=8010, addr='')
	return parser
示例#6
0
def setup_options():
	parser = dwconfig.setup_options("%prog [--help] [options] CONFIG URL COUNT [RENDERER]",
					"testbench 0.1")
	parser.add_option('-B', '--no-bfc', dest="rmconfig",
			  action="append_const", const="bfc-cache-ttl",
			  help="disable the Brute Force Cache")
	parser.add_option('-I', '--no-imc', dest='rmconfig',
			  action="append_const", const="imc-cache-entries",
			  help="disable the In Memory Cache")
	parser.add_option('-6', '--ipv6-origin', dest="ip6origin",
			  action="store_true",
			  help="make requests appear to come from the IPv6 localhost address instead of the IPv4 one")
	parser.add_option('-W', '--warmup-count', dest="prerun",
			  action="store", type="int",
			  help="make this many requests as an untimed warmup")
	parser.add_option('-P', '--profile', dest='operation',
			  action="store_const", const=doProfile,
			  help="profile, using the Python profiler")
	parser.add_option('-S', '--statprof', dest="operation",
			  action="store_const", const=doStatProf,
			  help="profile, using the statistical profiler")
	parser.set_defaults(operation = doTime, ip6origin = False,
			    prerun = 0)
	return parser
示例#7
0
def setup_options():
    defMaxconn = 10
    defMinconn = 4
    defPerconn = 100
    defMinidle = 1
    parser = dwconfig.setup_options("%prog [--help] [options] CONF-FILE", "dwiki-scgi 0.1")

    parser.add_option("-v", "--verbose", dest="verbose", action="store_true", help="be more verbose")
    parser.add_option(
        "-L",
        "--lockfile",
        type="string",
        metavar="FILE",
        dest="lockfile",
        help="lock this file (must exist) for mutual exclusion (primarily on startup).",
    )

    group2 = OptionGroup(
        parser,
        "What to listen on",
        "You must give one of -s, -p, or --systemd-socket to specify where to listen for SCGI requests.",
    )
    parser.add_option_group(group2)
    group2.add_option(
        "-s",
        "--socket-file",
        dest="sockfile",
        type="string",
        metavar="SOCK",
        help="use SOCK as the (Unix) socket path.",
    )
    group2.add_option(
        "-P",
        "--perms",
        dest="perms",
        type="string",
        metavar="PERM",
        help="with -s, set the socket permissions to this value (a number). Use a leading 0 to force octal, eg '0666'.",
    )
    group2.add_option(
        "",
        "--systemd-socket",
        dest="systemd",
        action="store_true",
        help="use the systemd socket activation protocol to get our socket.",
    )
    group2.add_option("-p", "--port", type="int", metavar="PORT", dest="port", help="listen on port PORT.")
    group2.add_option(
        "-a",
        "--address",
        type="string",
        metavar="ADDR",
        dest="addr",
        help="listen at IP address ADDR (the default is to listen on all).",
    )

    group0 = OptionGroup(parser, "Options to control when we exit")
    parser.add_option_group(group0)
    group0.add_option(
        "-S",
        "--stopfile",
        dest="stopfile",
        type="string",
        metavar="FILE",
        help="Use FILE as the stop file (no default). The server will exit after the next request if FILE exists and has a modification time that is after it started.",
    )
    group0.add_option(
        "",
        "--idle-timeout",
        dest="idletimeout",
        type="float",
        metavar="MIN",
        help="Server exits after MIN minutes (may be fractional) if there has been no activity. This may preempt --min-lifetime.",
    )
    group0.add_option(
        "-l",
        "--low-loadavg",
        dest="minloadavg",
        type="float",
        metavar="LAVG",
        help="Server dies if all three load average numbers are under LAVG.",
    )
    group0.add_option(
        "",
        "--min-lifetime",
        dest="minlifetime",
        type="float",
        metavar="MIN",
        help="Server runs for at least MIN minutes (may be fractional) regardless of the load average (no default).",
    )

    group1 = OptionGroup(
        parser, "Load control options", "Note that a number of these options do not do anything if you specify --fork."
    )
    parser.add_option_group(group1)
    group1.add_option(
        "-m",
        "--maxconn",
        dest="maxconn",
        type="int",
        metavar="NUM",
        action="store",
        help=("limit us to NUM worker processes and thus NUM simultaneous connections (default %d)." % defMaxconn),
    )
    group1.add_option(
        "",
        "--drop-on-overload",
        dest="dropoverload",
        action="store_true",
        help="drop new requests when all worker processes are busy instead of waiting for the next one to become free. (Not recommended.)",
    )
    group1.add_option(
        "",
        "--min-workers",
        dest="minconn",
        type="int",
        metavar="NUM",
        action="store",
        help=("always have NUM worker processes (default %d)." % defMinconn),
    )
    group1.add_option(
        "",
        "--restart-after",
        dest="perconn",
        type="int",
        metavar="NUM",
        action="store",
        help=("restart each worker process after it handles NUM connections (default %d)." % defPerconn),
    )
    group1.add_option(
        "",
        "--min-idle",
        dest="minidle",
        type="int",
        metavar="NUM",
        action="store",
        help=("try to always have NUM idle worker processes (default %d)" % defMinidle),
    )
    group1.add_option(
        "",
        "--worker-timeout",
        dest="workertimeout",
        type="float",
        metavar="MIN",
        help="Spare worker processes exit after MIN minutes of inactivity (as usual, MIN may be fractional).",
    )

    group3 = OptionGroup(parser, "Obscure options")
    parser.add_option_group(group3)
    group3.add_option(
        "-N",
        "--null-app",
        dest="nullapp",
        action="store_true",
        help="run a null application for timing purposes, instead of DWiki.",
    )
    group3.add_option(
        "",
        "--fork",
        dest="servtype",
        action="store_const",
        const="fork",
        help="server forks to handle each connection, instead of using a pool of preforked worker processes.",
    )
    parser.set_defaults(
        maxconn=defMaxconn,
        minconn=defMinconn,
        perconn=defPerconn,
        minidle=defMinidle,
        servtype="prefork",
        dropoverload=False,
        sockfile=None,
        port=None,
        addr="",
        systemd=False,
        stopfile=None,
        perms=None,
        minloadavg=None,
        minlifetime=None,
        idletimeout=None,
        workertimeout=None,
        lockfile=None,
        verbose=False,
        nullapp=False,
    )
    return parser
示例#8
0
def setup_options():
    parser = dwconfig.setup_options(
        "%prog [--help] [options] CONFIG URL [RENDERER]", "dwiki-cat 0.1")
    return parser
示例#9
0
def setup_options():
	parser = dwconfig.setup_options("%prog [--help] [options] CONFIG URL [RENDERER]",
					"dwiki-cat 0.1")
	return parser
示例#10
0
def setup_options():
    defMaxconn = 10
    defMinconn = 4
    defPerconn = 100
    defMinidle = 1
    parser = dwconfig.setup_options("%prog [--help] [options] CONF-FILE",
                                    "dwiki-scgi 0.1")

    parser.add_option('-v',
                      '--verbose',
                      dest="verbose",
                      action="store_true",
                      help="be more verbose")
    parser.add_option(
        '-L',
        '--lockfile',
        type="string",
        metavar="FILE",
        dest="lockfile",
        help=
        "lock this file (must exist) for mutual exclusion (primarily on startup)."
    )

    group2 = OptionGroup(
        parser, "What to listen on",
        "You must give one of -s, -p, or --systemd-socket to specify where to listen for SCGI requests."
    )
    parser.add_option_group(group2)
    group2.add_option('-s',
                      '--socket-file',
                      dest="sockfile",
                      type='string',
                      metavar='SOCK',
                      help="use SOCK as the (Unix) socket path.")
    group2.add_option(
        '-P',
        '--perms',
        dest='perms',
        type='string',
        metavar="PERM",
        help=
        "with -s, set the socket permissions to this value (a number). Use a leading 0 to force octal, eg '0666'."
    )
    group2.add_option(
        '',
        '--systemd-socket',
        dest="systemd",
        action="store_true",
        help="use the systemd socket activation protocol to get our socket.")
    group2.add_option('-p',
                      '--port',
                      type="int",
                      metavar="PORT",
                      dest="port",
                      help="listen on port PORT.")
    group2.add_option(
        '-a',
        '--address',
        type="string",
        metavar="ADDR",
        dest="addr",
        help="listen at IP address ADDR (the default is to listen on all).")

    group0 = OptionGroup(parser, "Options to control when we exit")
    parser.add_option_group(group0)
    group0.add_option(
        '-S',
        '--stopfile',
        dest="stopfile",
        type="string",
        metavar='FILE',
        help=
        "Use FILE as the stop file (no default). The server will exit after the next request if FILE exists and has a modification time that is after it started."
    )
    group0.add_option(
        '',
        '--idle-timeout',
        dest="idletimeout",
        type="float",
        metavar="MIN",
        help=
        "Server exits after MIN minutes (may be fractional) if there has been no activity. This may preempt --min-lifetime."
    )
    group0.add_option(
        '-l',
        '--low-loadavg',
        dest="minloadavg",
        type="float",
        metavar="LAVG",
        help="Server dies if all three load average numbers are under LAVG.")
    group0.add_option(
        '',
        '--min-lifetime',
        dest="minlifetime",
        type="float",
        metavar="MIN",
        help=
        "Server runs for at least MIN minutes (may be fractional) regardless of the load average (no default)."
    )

    group1 = OptionGroup(
        parser, "Load control options",
        "Note that a number of these options do not do anything if you specify --fork."
    )
    parser.add_option_group(group1)
    group1.add_option(
        '-m',
        '--maxconn',
        dest="maxconn",
        type="int",
        metavar='NUM',
        action='store',
        help=
        ("limit us to NUM worker processes and thus NUM simultaneous connections (default %d)."
         % defMaxconn))
    group1.add_option(
        '',
        '--drop-on-overload',
        dest='dropoverload',
        action="store_true",
        help=
        "drop new requests when all worker processes are busy instead of waiting for the next one to become free. (Not recommended.)"
    )
    group1.add_option('',
                      '--min-workers',
                      dest="minconn",
                      type="int",
                      metavar="NUM",
                      action='store',
                      help=("always have NUM worker processes (default %d)." %
                            defMinconn))
    group1.add_option(
        '',
        '--restart-after',
        dest='perconn',
        type='int',
        metavar='NUM',
        action='store',
        help=
        ("restart each worker process after it handles NUM connections (default %d)."
         % defPerconn))
    group1.add_option(
        '',
        '--min-idle',
        dest='minidle',
        type='int',
        metavar='NUM',
        action="store",
        help=("try to always have NUM idle worker processes (default %d)" %
              defMinidle))
    group1.add_option(
        '',
        '--worker-timeout',
        dest='workertimeout',
        type="float",
        metavar="MIN",
        help=
        "Spare worker processes exit after MIN minutes of inactivity (as usual, MIN may be fractional)."
    )

    group3 = OptionGroup(parser, "Obscure options")
    parser.add_option_group(group3)
    group3.add_option(
        '-N',
        '--null-app',
        dest='nullapp',
        action="store_true",
        help="run a null application for timing purposes, instead of DWiki.")
    group3.add_option(
        '',
        '--fork',
        dest="servtype",
        action="store_const",
        const="fork",
        help=
        "server forks to handle each connection, instead of using a pool of preforked worker processes."
    )
    parser.set_defaults(maxconn=defMaxconn,
                        minconn=defMinconn,
                        perconn=defPerconn,
                        minidle=defMinidle,
                        servtype="prefork",
                        dropoverload=False,
                        sockfile=None,
                        port=None,
                        addr='',
                        systemd=False,
                        stopfile=None,
                        perms=None,
                        minloadavg=None,
                        minlifetime=None,
                        idletimeout=None,
                        workertimeout=None,
                        lockfile=None,
                        verbose=False,
                        nullapp=False)
    return parser