feat: harden node placement and partial model loading
This commit is contained in:
@@ -36,6 +36,12 @@ def _load_env_file(path: Path) -> None:
|
||||
os.environ[key] = value
|
||||
|
||||
|
||||
def _apply_relay_concurrency_flag(value: int | None) -> None:
|
||||
"""Expose relay bridge worker cap via CLI (env MESHNET_RELAY_CONCURRENCY)."""
|
||||
if value is not None:
|
||||
os.environ["MESHNET_RELAY_CONCURRENCY"] = str(max(1, value))
|
||||
|
||||
|
||||
def _load_env_defaults() -> None:
|
||||
"""Load machine-specific, local, and user-level node env defaults."""
|
||||
machine = socket.gethostname().strip()
|
||||
@@ -189,6 +195,8 @@ def _cmd_default(args) -> int:
|
||||
if getattr(args, "cpu", False):
|
||||
overrides["force_cpu"] = True
|
||||
|
||||
_apply_relay_concurrency_flag(getattr(args, "relay_concurrency", None))
|
||||
|
||||
if overrides:
|
||||
cfg = merge_cli_overrides(cfg, **overrides)
|
||||
|
||||
@@ -349,6 +357,8 @@ def _cmd_start(args) -> int:
|
||||
if getattr(args, "node_name", None):
|
||||
cfg["node_name"] = args.node_name
|
||||
|
||||
_apply_relay_concurrency_flag(getattr(args, "relay_concurrency", None))
|
||||
|
||||
# Legacy start: just run without the dashboard (keep original blocking loop)
|
||||
from .startup import run_startup
|
||||
|
||||
@@ -433,6 +443,8 @@ def main() -> None:
|
||||
help="Set PyTorch inter-op CPU worker threads")
|
||||
parser.add_argument("--cpu", action="store_true",
|
||||
help="Force CPU inference even when a GPU is available")
|
||||
parser.add_argument("--relay-concurrency", type=int, metavar="N",
|
||||
help="Max concurrent relay-http-request workers (env MESHNET_RELAY_CONCURRENCY)")
|
||||
parser.add_argument("--debug", action="store_true", help="Enable verbose node debug logging")
|
||||
parser.add_argument("--no-tui", action="store_true", help="Plain-text output (no rich dashboard)")
|
||||
parser.add_argument("--compact", action="store_true", help="Single-line status output")
|
||||
@@ -510,6 +522,8 @@ def main() -> None:
|
||||
help="Set PyTorch inter-op CPU worker threads")
|
||||
start_cmd.add_argument("--cpu", action="store_true",
|
||||
help="Force CPU inference even when a GPU is available")
|
||||
start_cmd.add_argument("--relay-concurrency", type=int, metavar="N",
|
||||
help="Max concurrent relay-http-request workers (env MESHNET_RELAY_CONCURRENCY)")
|
||||
start_cmd.add_argument("--debug", action="store_true", help="Enable verbose node debug logging")
|
||||
start_cmd.add_argument("--tracker-source-disabled", action="store_true",
|
||||
help="Skip tracker/peer model-file sources and download from HuggingFace directly")
|
||||
|
||||
Reference in New Issue
Block a user