Exemplo n.º 1
0
def main():
    parser = _parser()
    args = parser.parse_args()

    if args.version:
        print(__version__)
        sys.exit(0)

    if args.config:
        if args.scenario == 'loadtest.py':
            args.scenario = 'test'

        try:
            expand_options(args.config, args.scenario, args)
        except OptionError as e:
            print(str(e))
            sys.exit(0)

    if args.statsd:
        # early import to quit if no aiostatsd
        from aiostatsd.client import StatsdClient
        if StatsdClient is None:
            print('You need to install aiostatsd when using --statds')
            sys.exit(0)

    return run(args)
Exemplo n.º 2
0
def main(args=None):
    if args is None:
        parser = _parser()
        args = parser.parse_args()

    if args.version:
        print(__version__)
        sys.exit(0)

    if args.processes > 1 and os.name == "nt":
        print("The -p/--processes option is unsupported on win32")
        sys.exit(0)

    if args.config:
        if args.scenario == "loadtest.py":
            args.scenario = "test"

        try:
            expand_options(args.config, args.scenario, args)
        except OptionError as e:
            print(str(e))
            sys.exit(0)

    if args.uvloop:
        if PYPY:
            print("You can't use uvloop with PyPy")  # pragma: no cover
            sys.exit(0)  # pragma: no cover

        try:
            import uvloop
        except ImportError:
            print("You need to install uvloop when using --uvloop")
            sys.exit(0)

        import asyncio

        asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())

    if args.sizing:
        # sizing is just ramping up workers indefinitely until
        # something things break. If the user has not set the values,
        # we do it here with 5 minutes and 500 workers
        if args.ramp_up == 0.0:
            args.ramp_up = 300
        if args.workers == 1:
            args.workers = 500

    run(args)
    return 0
Exemplo n.º 3
0
Arquivo: run.py Projeto: loads/ailoads
def main(args=None):
    if args is None:
        parser = _parser()
        args = parser.parse_args()

    if args.version:
        print(__version__)
        sys.exit(0)

    if args.config:
        if args.scenario == 'loadtest.py':
            args.scenario = 'test'

        try:
            expand_options(args.config, args.scenario, args)
        except OptionError as e:
            print(str(e))
            sys.exit(0)

    if args.uvloop:
        if PYPY:
            print("You can't use uvloop with PyPy")     # pragma: no cover
            sys.exit(0)                                 # pragma: no cover

        try:
            import uvloop
        except ImportError:
            print('You need to install uvloop when using --uvloop')
            sys.exit(0)

        import asyncio
        asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())

    if args.sizing:
        # sizing is just ramping up workers indefinitely until
        # something things break. If the user has not set the values,
        # we do it here with 5 minutes and 500 workers
        if args.ramp_up == 0.:
            args.ramp_up = 300
        if args.workers == 1:
            args.workers = 500

    return run(args)
Exemplo n.º 4
0
def main():
    parser = _parser()
    args = parser.parse_args()

    if args.version:
        print(__version__)
        sys.exit(0)

    if args.config:
        if args.scenario == 'loadtest.py':
            args.scenario = 'test'

        try:
            expand_options(args.config, args.scenario, args)
        except OptionError as e:
            print(str(e))
            sys.exit(0)

    if args.uvloop:
        if PYPY:
            print("You can't use uvloop with PyPy")
            sys.exit(0)

        try:
            import uvloop
        except ImportError:
            print('You need to install uvloop when using --uvloop')
            sys.exit(0)

        import asyncio
        asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())

    if args.sizing:
        # sizing is just ramping up workers indefinitely until
        # something things break. If the user has not set the values,
        # we do it here with 5 minutes and 500 workers
        if args.ramp_up == 0.:
            args.ramp_up = 300
        if args.workers == 1:
            args.workers = 500

    return run(args)
Exemplo n.º 5
0
 def test_config(self):
     args = Args()
     expand_options(config, "test", args)
     self.assertEqual(args.duration, 1)