-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlaunch_rpyc.py
More file actions
27 lines (25 loc) · 944 Bytes
/
launch_rpyc.py
File metadata and controls
27 lines (25 loc) · 944 Bytes
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
#!/usr/bin/env python
import argparse
import logging
import time
import threading
import rpyc
import sys
from implementations.rpyc_impl import BenchmarkService
def run_server(port):
logging.basicConfig(level=logging.INFO, format='%(asctime)s %(levelname)s: %(message)s')
# Create the RPyC server using BenchmarkService
server = rpyc.ThreadedServer(BenchmarkService, port=port, protocol_config={"allow_public_attrs": True})
thread = threading.Thread(target=server.start, daemon=True)
thread.start()
time.sleep(0.5)
print("READY", flush=True)
sys.stdout.flush() # Ensure the READY signal is sent immediately
# Keep the server running indefinitely
while True:
time.sleep(3600)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--port", type=int, default=18861, help="Port to bind the RPyC server")
args = parser.parse_args()
run_server(args.port)