Esempio n. 1
0
    observer.schedule(event_handler, path, recursive=True)
    observer.start()
    try:
        while True:
            time.sleep(10)
    except KeyboardInterrupt:
        observer.stop()
    observer.join()


@Commands.command(
    'server',
    help='Start an instance of a CodaLab bundle service with a REST API.',
    arguments=(
        Commands.Argument(
            '--watch', help='Restart the server on code changes.',
            action='store_true'),
        Commands.Argument(
            '-p', '--processes',
            help='Number of processes to use. A production deployment should '
                 'use more than 1 process to make the best use of multiple '
                 'CPUs.',
            type=int, default=1),
        Commands.Argument(
            '-t', '--threads',
            help='Number of threads to use. The server will be able to handle '
                 '(--processes) x (--threads) requests at the same time.',
            type=int, default=50),
        Commands.Argument(
            '-d', '--debug', help='Run the development server for debugging.',
            action='store_true'),
Esempio n. 2
0
    observer = Observer()
    observer.schedule(event_handler, path, recursive=True)
    observer.start()
    try:
        while True:
            time.sleep(10)
    except KeyboardInterrupt:
        observer.stop()
    observer.join()


@Commands.command(
    'server',
    help='Start an instance of the CodaLab bundle service.',
    arguments=(Commands.Argument('--watch',
                                 help='Restart the server on code changes.',
                                 action='store_true'), ),
)
def do_server_command(bundle_cli, args):
    if args.watch:
        run_server_with_watch()
    else:
        from codalab.server.bundle_rpc_server import BundleRPCServer
        rpc_server = BundleRPCServer(bundle_cli.manager)
        rpc_server.serve_forever()


@Commands.command(
    'rest-server',
    help='Start an instance of a CodaLab bundle service with a REST API.',
    arguments=(