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()
def run_server(): if '--watch' in sys.argv: # Listen to root dir (/codalab/bin/../../) path = os.path.join(os.path.dirname(__file__), '../../') event_handler = ClFileWatcherEventHandler() observer = Observer() observer.schedule(event_handler, path, recursive=True) observer.start() try: while True: time.sleep(10) except KeyboardInterrupt: observer.stop() observer.join() else: from codalab.server.bundle_rpc_server import BundleRPCServer rpc_server = BundleRPCServer(manager) rpc_server.serve_forever()
#!/usr/bin/env python import sys from codalab.lib.codalab_manager import CodaLabManager if __name__ == '__main__': manager = CodaLabManager() # Either start the server or the client. if sys.argv[1:] == ['server']: from codalab.server.bundle_rpc_server import BundleRPCServer rpc_server = BundleRPCServer(manager) rpc_server.serve_forever() else: from codalab.lib.bundle_cli import BundleCLI cli = BundleCLI(manager) cli.do_command(sys.argv[1:])