Skip to content

Commit fd50821

Browse files
sl-gnsibianl
andauthored
refactor(cli): prompt users to report information when connecting to … (#202)
Co-authored-by: sibianl <sibianl@rings.net.cn>
1 parent 7bc6e32 commit fd50821

File tree

10 files changed

+24
-14
lines changed

10 files changed

+24
-14
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ Open http://localhost:3001 and you should see the setup interface.
178178

179179
Select your desired node and model config and click continue.
180180

181+
> **Note:**
182+
When running in remote mode, Parallax will use a public relay server to help establish connections between the scheduler and nodes. The public relay server will receive the IP information of both the scheduler and the nodes in order to facilitate this connection.
183+
181184
#### Step 3: Connect your nodes
182185

183186
Copy the generated join command line to your node and run. For remote connection, you can find your scheduler-address in the scheduler logs.

src/backend/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
from backend.server.scheduler_manage import SchedulerManage
1414
from backend.server.server_args import parse_args
1515
from backend.server.static_config import get_model_list, get_node_join_command
16-
from common.file_util import get_project_root
17-
from common.version_check import check_latest_release
1816
from parallax_utils.ascii_anime import display_parallax_run
17+
from parallax_utils.file_util import get_project_root
1918
from parallax_utils.logging_config import get_logger, set_log_level
19+
from parallax_utils.version_check import check_latest_release
2020

2121
app = FastAPI()
2222

src/backend/server/request_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
from starlette.concurrency import iterate_in_threadpool
88

99
from backend.server.constants import NODE_STATUS_AVAILABLE
10-
from common.request_metrics import get_request_metrics
1110
from parallax_utils.logging_config import get_logger
11+
from parallax_utils.request_metrics import get_request_metrics
1212

1313
logger = get_logger(__name__)
1414

src/parallax/cli.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
import machineid
1919
import requests
2020

21-
from common.file_util import get_project_root
22-
from common.version_check import get_current_version
2321
from parallax.server.server_info import HardwareInfo
22+
from parallax_utils.file_util import get_project_root
2423
from parallax_utils.logging_config import get_logger
24+
from parallax_utils.version_check import get_current_version
2525

2626
logger = get_logger("parallax.cli")
2727

@@ -47,7 +47,7 @@
4747
def check_python_version():
4848
"""Check if Python version is 3.11 or higher."""
4949
if sys.version_info < (3, 11) or sys.version_info >= (3, 14):
50-
print(
50+
logger.info(
5151
f"Error: Python 3.11 or higher and less than 3.14 is required. Current version is {sys.version_info.major}.{sys.version_info.minor}."
5252
)
5353
sys.exit(1)
@@ -185,7 +185,7 @@ def run_command(args, passthrough_args: list[str] | None = None):
185185
backend_main = project_root / "src" / "backend" / "main.py"
186186

187187
if not backend_main.exists():
188-
print(f"Error: Backend main.py not found at {backend_main}")
188+
logger.info(f"Error: Backend main.py not found at {backend_main}")
189189
sys.exit(1)
190190

191191
# Build the command to run the backend main.py
@@ -201,6 +201,9 @@ def run_command(args, passthrough_args: list[str] | None = None):
201201
cmd.extend(["--init-nodes-num", str(args.init_nodes_num)])
202202
if args.use_relay:
203203
cmd.extend(_get_relay_params())
204+
logger.info(
205+
"Using public relay server to help nodes and the scheduler establish a connection (remote mode). Your IP address will be reported to the relay server to help establish the connection."
206+
)
204207

205208
# Append any passthrough args (unrecognized by this CLI) directly to the command
206209
if passthrough_args:
@@ -220,7 +223,7 @@ def join_command(args, passthrough_args: list[str] | None = None):
220223
launch_script = project_root / "src" / "parallax" / "launch.py"
221224

222225
if not launch_script.exists():
223-
print(f"Error: Launch script not found at {launch_script}")
226+
logger.info(f"Error: Launch script not found at {launch_script}")
224227
sys.exit(1)
225228

226229
# Set environment variable for the subprocess
@@ -247,8 +250,10 @@ def join_command(args, passthrough_args: list[str] | None = None):
247250
if args.use_relay or (
248251
args.scheduler_addr != "auto" and not str(args.scheduler_addr).startswith("/")
249252
):
250-
logger.info("Using public relay servers")
251253
cmd.extend(_get_relay_params())
254+
logger.info(
255+
"Using public relay server to help nodes and the scheduler establish a connection (remote mode). Your IP address will be reported to the relay server to help establish the connection."
256+
)
252257

253258
# Append any passthrough args (unrecognized by this CLI) directly to the command
254259
if passthrough_args:
@@ -266,7 +271,7 @@ def chat_command(args, passthrough_args: list[str] | None = None):
266271
launch_script = project_root / "src" / "parallax" / "launch_chat.py"
267272

268273
if not launch_script.exists():
269-
print(f"Error: Launch chat script not found at {launch_script}")
274+
logger.info(f"Error: Launch chat script not found at {launch_script}")
270275
sys.exit(1)
271276

272277
# Build the command to run the launch_chat.py script
@@ -279,8 +284,10 @@ def chat_command(args, passthrough_args: list[str] | None = None):
279284
if args.use_relay or (
280285
args.scheduler_addr != "auto" and not str(args.scheduler_addr).startswith("/")
281286
):
282-
logger.info("Using public relay servers")
283287
cmd.extend(_get_relay_params())
288+
logger.info(
289+
"Using public relay server to help chat client and the scheduler establish a connection (remote mode). Your IP address will be reported to the relay server to help establish the connection."
290+
)
284291

285292
# Append any passthrough args (unrecognized by this CLI) directly to the command
286293
if passthrough_args:

src/parallax/launch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
import tempfile
1919
import threading
2020

21-
from common.version_check import check_latest_release
2221
from parallax.p2p.server import ServerState, launch_p2p_server
2322
from parallax.server.executor import Executor
2423
from parallax.server.http_server import launch_http_server, stop_http_server
2524
from parallax.server.server_args import parse_args
2625
from parallax_utils.ascii_anime import display_parallax_join
2726
from parallax_utils.logging_config import get_logger, set_log_level
27+
from parallax_utils.version_check import check_latest_release
2828

2929
logger = get_logger("parallax.launch")
3030

src/parallax/server/node_chat_http_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from starlette.datastructures import State
1414

1515
from backend.server.rpc_connection_handler import RPCConnectionHandler
16-
from common.file_util import get_project_root
16+
from parallax_utils.file_util import get_project_root
1717
from parallax_utils.logging_config import get_logger
1818

1919
logger = get_logger(__name__)

src/parallax_utils/ascii_anime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import math
33
import os
44

5-
from common.file_util import get_project_root
5+
from parallax_utils.file_util import get_project_root
66

77

88
class HexColorPrinter:
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)