feat: MAINT-001 - Fix Ruff violations across all Python source
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
import http.server
|
import http.server
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import os
|
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
import threading
|
import threading
|
||||||
@@ -62,7 +61,7 @@ class _GatewayHTTPServer(http.server.HTTPServer):
|
|||||||
|
|
||||||
|
|
||||||
class _GatewayHandler(http.server.BaseHTTPRequestHandler):
|
class _GatewayHandler(http.server.BaseHTTPRequestHandler):
|
||||||
def log_message(self, fmt, *args): # noqa: suppress request logs in tests
|
def log_message(self, fmt, *args): # suppress request logs in tests
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def do_GET(self):
|
def do_GET(self):
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ def _cmd_default(args) -> int:
|
|||||||
print("\nSetup cancelled.")
|
print("\nSetup cancelled.")
|
||||||
return 1
|
return 1
|
||||||
save_config(cfg)
|
save_config(cfg)
|
||||||
print(f"\nConfig saved to ~/.config/meshnet/config.json\n")
|
print("\nConfig saved to ~/.config/meshnet/config.json\n")
|
||||||
|
|
||||||
# Apply CLI overrides on top of saved config
|
# Apply CLI overrides on top of saved config
|
||||||
overrides: dict = {}
|
overrides: dict = {}
|
||||||
@@ -198,7 +198,7 @@ def _cmd_default(args) -> int:
|
|||||||
|
|
||||||
def _cmd_models(args) -> int:
|
def _cmd_models(args) -> int:
|
||||||
"""List curated models (with optional HF Hub browse)."""
|
"""List curated models (with optional HF Hub browse)."""
|
||||||
from .wizard import print_models_table, _browse_hf_interactive
|
from .wizard import print_models_table
|
||||||
|
|
||||||
if args.browse:
|
if args.browse:
|
||||||
from .model_catalog import browse_hf_hub
|
from .model_catalog import browse_hf_hub
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ from __future__ import annotations
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from collections import deque
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@@ -114,7 +113,7 @@ def run_dashboard(node, config: dict, start_time: float) -> None:
|
|||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from rich.live import Live # type: ignore[import]
|
from rich.live import Live # type: ignore[import] # noqa: F401
|
||||||
|
|
||||||
_run_rich_dashboard(node, config, start_time)
|
_run_rich_dashboard(node, config, start_time)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@@ -126,7 +125,6 @@ def _build_rich_renderable(
|
|||||||
):
|
):
|
||||||
from rich.table import Table # type: ignore[import]
|
from rich.table import Table # type: ignore[import]
|
||||||
from rich.panel import Panel # type: ignore[import]
|
from rich.panel import Panel # type: ignore[import]
|
||||||
from rich.columns import Columns # type: ignore[import]
|
|
||||||
from rich.text import Text # type: ignore[import]
|
from rich.text import Text # type: ignore[import]
|
||||||
|
|
||||||
uptime = time.monotonic() - start_time
|
uptime = time.monotonic() - start_time
|
||||||
@@ -178,8 +176,8 @@ def _build_rich_renderable(
|
|||||||
f"Tokens/sec {tps_bar} {tps:.1f} t/s (EMA)",
|
f"Tokens/sec {tps_bar} {tps:.1f} t/s (EMA)",
|
||||||
f"Requests {req_count:,} served",
|
f"Requests {req_count:,} served",
|
||||||
f"Success {stats['success_rate']:.1f}% failed {stats['failed_requests']:,} queue {stats['queue_depth']}",
|
f"Success {stats['success_rate']:.1f}% failed {stats['failed_requests']:,} queue {stats['queue_depth']}",
|
||||||
f"Peers 0 connected (gossip: US-017)",
|
"Peers 0 connected (gossip: US-017)",
|
||||||
f"TAI earned 0.00 TAI (payments: US-006)",
|
"TAI earned 0.00 TAI (payments: US-006)",
|
||||||
f"Uptime {_format_uptime(uptime)}",
|
f"Uptime {_format_uptime(uptime)}",
|
||||||
"",
|
"",
|
||||||
"[q] quit [c] compact view",
|
"[q] quit [c] compact view",
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ class _StubHTTPServer(http.server.HTTPServer):
|
|||||||
|
|
||||||
|
|
||||||
class _StubHandler(http.server.BaseHTTPRequestHandler):
|
class _StubHandler(http.server.BaseHTTPRequestHandler):
|
||||||
def log_message(self, fmt, *args): # noqa: suppress request logs in tests
|
def log_message(self, fmt, *args): # suppress request logs in tests
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def do_POST(self):
|
def do_POST(self):
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ from .model_backend import (
|
|||||||
InsufficientVRAMError,
|
InsufficientVRAMError,
|
||||||
KVCacheMiss,
|
KVCacheMiss,
|
||||||
MissingModelDependencyError,
|
MissingModelDependencyError,
|
||||||
Quantization,
|
|
||||||
TailTokenResult,
|
TailTokenResult,
|
||||||
TorchModelShard,
|
TorchModelShard,
|
||||||
_tensor_from_bfloat16_bytes,
|
_tensor_from_bfloat16_bytes,
|
||||||
@@ -46,7 +45,7 @@ class _DirectRequestUncertainError(ConnectionError):
|
|||||||
"""A direct request may have reached the downstream node but did not finish."""
|
"""A direct request may have reached the downstream node but did not finish."""
|
||||||
|
|
||||||
|
|
||||||
from .server import (
|
from .server import ( # noqa: E402
|
||||||
_WIRE_VERSION,
|
_WIRE_VERSION,
|
||||||
_parse_shape,
|
_parse_shape,
|
||||||
_validate_activation_body,
|
_validate_activation_body,
|
||||||
@@ -399,7 +398,7 @@ class _TorchHandler(http.server.BaseHTTPRequestHandler):
|
|||||||
# Finite responses below provide Content-Length; streams are chunked.
|
# Finite responses below provide Content-Length; streams are chunked.
|
||||||
protocol_version = "HTTP/1.1"
|
protocol_version = "HTTP/1.1"
|
||||||
|
|
||||||
def log_message(self, fmt, *args): # noqa: suppress request logs in tests
|
def log_message(self, fmt, *args): # suppress request logs in tests
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _request_id(self) -> str:
|
def _request_id(self) -> str:
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import sys
|
|
||||||
import urllib.error
|
import urllib.error
|
||||||
import urllib.request
|
import urllib.request
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import socket
|
import socket
|
||||||
import threading
|
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|||||||
@@ -3,9 +3,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import hashlib
|
|
||||||
import ipaddress
|
import ipaddress
|
||||||
import json
|
|
||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
import ssl
|
import ssl
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
import logging
|
||||||
import sys
|
|
||||||
import time
|
import time
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ import threading
|
|||||||
import time
|
import time
|
||||||
import urllib.error
|
import urllib.error
|
||||||
import urllib.request
|
import urllib.request
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass
|
||||||
from typing import Any, Callable
|
from typing import Callable
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import random
|
|||||||
import sqlite3
|
import sqlite3
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass
|
||||||
from typing import Any, Iterable
|
from typing import Any, Iterable
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -53,10 +53,6 @@ from typing import Any
|
|||||||
from .accounts import DEFAULT_ACCOUNTS_DB_PATH, AccountStore
|
from .accounts import DEFAULT_ACCOUNTS_DB_PATH, AccountStore
|
||||||
from .auth import is_validator_token, sign_hive_request, verify_hive_request
|
from .auth import is_validator_token, sign_hive_request, verify_hive_request
|
||||||
from .capability import (
|
from .capability import (
|
||||||
DEFAULT_POLICY as DEFAULT_CAPABILITY_POLICY,
|
|
||||||
POLICY_COMPAT,
|
|
||||||
POLICY_ENFORCE,
|
|
||||||
STATE_ABSENT,
|
|
||||||
STATE_ADMITTED,
|
STATE_ADMITTED,
|
||||||
STATE_MODEL_MISMATCH,
|
STATE_MODEL_MISMATCH,
|
||||||
STATE_SHARD_MISMATCH,
|
STATE_SHARD_MISMATCH,
|
||||||
@@ -69,7 +65,7 @@ from .capability import (
|
|||||||
)
|
)
|
||||||
from .wallet_proof import binding_message, verify_wallet_signature
|
from .wallet_proof import binding_message, verify_wallet_signature
|
||||||
from .billing import DEFAULT_BILLING_DB_PATH, BillingLedger
|
from .billing import DEFAULT_BILLING_DB_PATH, BillingLedger
|
||||||
from .calibration import DEFAULT_CALIBRATION_DB_PATH, ToplocCalibrationStore
|
from .calibration import ToplocCalibrationStore
|
||||||
from .hf_pricing import DEFAULT_HF_PRICING_LOG_DB_PATH, HfPricingLog, refresh_preset_price
|
from .hf_pricing import DEFAULT_HF_PRICING_LOG_DB_PATH, HfPricingLog, refresh_preset_price
|
||||||
from .gossip import NodeGossip
|
from .gossip import NodeGossip
|
||||||
from .logging_setup import tracker_logger
|
from .logging_setup import tracker_logger
|
||||||
@@ -2566,8 +2562,8 @@ def _estimate_prompt_tokens(body: dict) -> int | None:
|
|||||||
|
|
||||||
|
|
||||||
def _requested_completion_token_limit(body: dict) -> int | None:
|
def _requested_completion_token_limit(body: dict) -> int | None:
|
||||||
for field in ("max_completion_tokens", "max_tokens"):
|
for key in ("max_completion_tokens", "max_tokens"):
|
||||||
value = body.get(field)
|
value = body.get(key)
|
||||||
if isinstance(value, bool):
|
if isinstance(value, bool):
|
||||||
return None
|
return None
|
||||||
if isinstance(value, (int, float)):
|
if isinstance(value, (int, float)):
|
||||||
@@ -2948,7 +2944,7 @@ class _TrackerHTTPServer(socketserver.ThreadingMixIn, http.server.HTTPServer):
|
|||||||
|
|
||||||
|
|
||||||
class _TrackerHandler(http.server.BaseHTTPRequestHandler):
|
class _TrackerHandler(http.server.BaseHTTPRequestHandler):
|
||||||
def log_message(self, fmt, *args): # noqa: suppress request logs in tests
|
def log_message(self, fmt, *args): # suppress request logs in tests
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _send_json(self, status: int, data: dict, headers: dict[str, str] | None = None) -> None:
|
def _send_json(self, status: int, data: dict, headers: dict[str, str] | None = None) -> None:
|
||||||
@@ -7069,10 +7065,6 @@ class TrackerServer:
|
|||||||
shard_end = int(payload["shard_end"]) if payload.get("shard_end") is not None else None
|
shard_end = int(payload["shard_end"]) if payload.get("shard_end") is not None else None
|
||||||
except (TypeError, ValueError):
|
except (TypeError, ValueError):
|
||||||
return
|
return
|
||||||
try:
|
|
||||||
friendly_name = _normalize_friendly_name(payload.get("friendly_name"))
|
|
||||||
except ValueError:
|
|
||||||
friendly_name = None
|
|
||||||
# The replicated payload is the raw registration body, so the follower can
|
# The replicated payload is the raw registration body, so the follower can
|
||||||
# resolve precision exactly as the leader did -- including telling a legacy
|
# resolve precision exactly as the leader did -- including telling a legacy
|
||||||
# absent `quantization` from a declared one. Dropping these fields here
|
# absent `quantization` from a declared one. Dropping these fields here
|
||||||
|
|||||||
@@ -545,6 +545,8 @@ def _post_json(url: str, payload: dict, timeout: float = 5.0) -> dict:
|
|||||||
__all__ = [
|
__all__ = [
|
||||||
"ToplocAuditConfig",
|
"ToplocAuditConfig",
|
||||||
"ToplocProofClaim",
|
"ToplocProofClaim",
|
||||||
|
"ToplocVerificationResult",
|
||||||
|
"verify_activation_proofs_detailed",
|
||||||
"ValidatorProcess",
|
"ValidatorProcess",
|
||||||
"AdaptiveAuditSampler",
|
"AdaptiveAuditSampler",
|
||||||
"AuditRateConfig",
|
"AuditRateConfig",
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ dev = ["pytest>=8", "openai>=1", "langchain-openai>=0.1", "cryptography>=41"]
|
|||||||
[tool.setuptools]
|
[tool.setuptools]
|
||||||
packages = []
|
packages = []
|
||||||
|
|
||||||
|
[tool.ruff]
|
||||||
|
# Protobuf/gRPC stubs are regenerated by scripts/generate_native_protocol.py;
|
||||||
|
# linting them would drift the checked-in files from the generator's output.
|
||||||
|
extend-exclude = ["packages/node/meshnet_node/native_protocol/generated"]
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
testpaths = ["tests"]
|
testpaths = ["tests"]
|
||||||
markers = [
|
markers = [
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ from __future__ import annotations
|
|||||||
import json
|
import json
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
from pathlib import Path
|
from unittest.mock import MagicMock
|
||||||
from unittest.mock import MagicMock, patch
|
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@@ -277,7 +276,6 @@ def test_relay_server_peer_list_grows_on_connect():
|
|||||||
def test_relay_circuit_relay_proxies_message():
|
def test_relay_circuit_relay_proxies_message():
|
||||||
"A node behind NAT (client_a) receives a message via circuit relay from client_b.\n\nTags: gossip, network, relay"
|
"A node behind NAT (client_a) receives a message via circuit relay from client_b.\n\nTags: gossip, network, relay"
|
||||||
|
|
||||||
import websockets.sync.client # type: ignore[import]
|
|
||||||
from meshnet_relay.server import RelayServer
|
from meshnet_relay.server import RelayServer
|
||||||
|
|
||||||
relay = RelayServer(host="127.0.0.1", port=0)
|
relay = RelayServer(host="127.0.0.1", port=0)
|
||||||
@@ -755,7 +753,6 @@ def test_node_relay_bridge_reconnects_after_failed_connection(monkeypatch):
|
|||||||
|
|
||||||
def _start_tracker_and_register(extra_fields: dict) -> dict:
|
def _start_tracker_and_register(extra_fields: dict) -> dict:
|
||||||
"""Helper: start tracker, register node with extra gossip fields, return response."""
|
"""Helper: start tracker, register node with extra gossip fields, return response."""
|
||||||
import http.server
|
|
||||||
import json as _json
|
import json as _json
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
|
||||||
@@ -766,7 +763,7 @@ def _start_tracker_and_register(extra_fields: dict) -> dict:
|
|||||||
url = f"http://127.0.0.1:{port}"
|
url = f"http://127.0.0.1:{port}"
|
||||||
|
|
||||||
payload = {
|
payload = {
|
||||||
"endpoint": f"http://127.0.0.1:8001",
|
"endpoint": "http://127.0.0.1:8001",
|
||||||
"shard_start": 0,
|
"shard_start": 0,
|
||||||
"shard_end": 7,
|
"shard_end": 7,
|
||||||
"model": "stub-model",
|
"model": "stub-model",
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ from __future__ import annotations
|
|||||||
import json
|
import json
|
||||||
import socket
|
import socket
|
||||||
import sys
|
import sys
|
||||||
import types
|
|
||||||
from pathlib import Path
|
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
# A fake node server has no real backend to prove capability with; say so
|
# A fake node server has no real backend to prove capability with; say so
|
||||||
@@ -134,7 +132,6 @@ def test_print_models_table_runs_without_error(capsys, monkeypatch):
|
|||||||
def test_wizard_writes_config_on_happy_path(tmp_path, monkeypatch):
|
def test_wizard_writes_config_on_happy_path(tmp_path, monkeypatch):
|
||||||
"Wizard writes config on happy path\n\nTags: general"
|
"Wizard writes config on happy path\n\nTags: general"
|
||||||
from meshnet_node import wizard as wiz
|
from meshnet_node import wizard as wiz
|
||||||
from meshnet_node.config import load_config, save_config
|
|
||||||
|
|
||||||
# Fake GPU
|
# Fake GPU
|
||||||
gpus = [{"index": 0, "name": "RTX 4090", "vram_gb": 24.0, "backend": "cuda"}]
|
gpus = [{"index": 0, "name": "RTX 4090", "vram_gb": 24.0, "backend": "cuda"}]
|
||||||
@@ -265,7 +262,6 @@ def test_config_command_no_config_exits_1(tmp_path, monkeypatch):
|
|||||||
|
|
||||||
def test_config_command_prints_saved_config(tmp_path, monkeypatch, capsys):
|
def test_config_command_prints_saved_config(tmp_path, monkeypatch, capsys):
|
||||||
"Config command prints saved config\n\nTags: general"
|
"Config command prints saved config\n\nTags: general"
|
||||||
from meshnet_node import config as cfg_mod
|
|
||||||
from meshnet_node.config import save_config
|
from meshnet_node.config import save_config
|
||||||
from meshnet_node.cli import main
|
from meshnet_node.cli import main
|
||||||
|
|
||||||
@@ -309,7 +305,6 @@ def test_detect_num_layers_returns_none_on_error(monkeypatch):
|
|||||||
def test_startup_auto_detects_shard_range(monkeypatch, tmp_path):
|
def test_startup_auto_detects_shard_range(monkeypatch, tmp_path):
|
||||||
"When shard_start/end are None, startup reads layer count from catalog.\n\nTags: general"
|
"When shard_start/end are None, startup reads layer count from catalog.\n\nTags: general"
|
||||||
from meshnet_node import startup as su
|
from meshnet_node import startup as su
|
||||||
from meshnet_node.model_catalog import detect_num_layers
|
|
||||||
|
|
||||||
calls = []
|
calls = []
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ def test_streaming_end_to_end_http(two_node_setup):
|
|||||||
assert "text/event-stream" in content_type
|
assert "text/event-stream" in content_type
|
||||||
raw = resp.read().decode()
|
raw = resp.read().decode()
|
||||||
|
|
||||||
data_lines = [l for l in raw.strip().splitlines() if l.startswith("data: ")]
|
data_lines = [line for line in raw.strip().splitlines() if line.startswith("data: ")]
|
||||||
assert data_lines, "No SSE data lines found"
|
assert data_lines, "No SSE data lines found"
|
||||||
assert data_lines[-1] == "data: [DONE]"
|
assert data_lines[-1] == "data: [DONE]"
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import urllib.request
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from meshnet_node.model_backend import (
|
from meshnet_node.model_backend import (
|
||||||
InsufficientVRAMError,
|
|
||||||
PartialModelLoadUnsupported,
|
PartialModelLoadUnsupported,
|
||||||
KVCacheMiss,
|
KVCacheMiss,
|
||||||
TensorPayload,
|
TensorPayload,
|
||||||
|
|||||||
@@ -5,9 +5,7 @@ before the transaction is sent, unconfirmed batches resent by settlement id
|
|||||||
(never double-paying), banned wallets skipped, history queryable over HTTP.
|
(never double-paying), banned wallets skipped, history queryable over HTTP.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
|
||||||
import time
|
import time
|
||||||
import urllib.request
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@@ -68,7 +66,7 @@ def test_threshold_triggers_payout_and_zeroes_pending():
|
|||||||
ledger.charge_request("client", MODEL, 1000, [("wallet-a", 12)]) # 0.018 pending
|
ledger.charge_request("client", MODEL, 1000, [("wallet-a", 12)]) # 0.018 pending
|
||||||
treasury = _FakePayoutTreasury()
|
treasury = _FakePayoutTreasury()
|
||||||
tracker = _make_tracker(ledger, treasury, threshold=0.01)
|
tracker = _make_tracker(ledger, treasury, threshold=0.01)
|
||||||
port = tracker.start()
|
tracker.start()
|
||||||
try:
|
try:
|
||||||
assert _wait_for(lambda: treasury.batches)
|
assert _wait_for(lambda: treasury.batches)
|
||||||
assert treasury.batches[0] == [("wallet-a", pytest.approx(0.018))]
|
assert treasury.batches[0] == [("wallet-a", pytest.approx(0.018))]
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ def test_registration_on_follower_visible_on_all_nodes(three_tracker_cluster):
|
|||||||
_wait_until_follower_knows_leader(follower, timeout=2.0)
|
_wait_until_follower_knows_leader(follower, timeout=2.0)
|
||||||
|
|
||||||
# Register via a follower
|
# Register via a follower
|
||||||
node_id = _register_node(follower, port_hint=19999)
|
_register_node(follower, port_hint=19999)
|
||||||
|
|
||||||
# Allow replication to propagate (Raft heartbeat interval is 50ms)
|
# Allow replication to propagate (Raft heartbeat interval is 50ms)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
@@ -223,7 +223,7 @@ def test_registration_on_leader_visible_to_all(three_tracker_cluster):
|
|||||||
urls = list(urls)
|
urls = list(urls)
|
||||||
|
|
||||||
leader_url, followers = _wait_for_leader(urls, timeout=1.0)
|
leader_url, followers = _wait_for_leader(urls, timeout=1.0)
|
||||||
node_id = _register_node(leader_url, port_hint=19996)
|
_register_node(leader_url, port_hint=19996)
|
||||||
|
|
||||||
# Allow Raft heartbeat to replicate the entry
|
# Allow Raft heartbeat to replicate the entry
|
||||||
time.sleep(0.3)
|
time.sleep(0.3)
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ from meshnet_tracker.server import (
|
|||||||
TrackerServer,
|
TrackerServer,
|
||||||
_NodeEntry,
|
_NodeEntry,
|
||||||
_available_quantizations,
|
_available_quantizations,
|
||||||
_memory_pool_map,
|
|
||||||
_rebalance_all_locked,
|
_rebalance_all_locked,
|
||||||
_registration_ban_error,
|
_registration_ban_error,
|
||||||
_scale_demanded_models_locked,
|
_scale_demanded_models_locked,
|
||||||
@@ -1448,7 +1447,7 @@ def test_tracker_pool_join_adds_redundant_copy_without_splitting_incumbent():
|
|||||||
"vram_bytes": 10_000, "ram_bytes": 10_000, "quantizations": ["bfloat16"],
|
"vram_bytes": 10_000, "ram_bytes": 10_000, "quantizations": ["bfloat16"],
|
||||||
"benchmark_tokens_per_sec": 1.0, "hardware_profile": {}, "score": 1.0},
|
"benchmark_tokens_per_sec": 1.0, "hardware_profile": {}, "score": 1.0},
|
||||||
)
|
)
|
||||||
second = _post_json(
|
_post_json(
|
||||||
f"http://127.0.0.1:{tracker_port}/v1/nodes/register",
|
f"http://127.0.0.1:{tracker_port}/v1/nodes/register",
|
||||||
{"endpoint": "http://127.0.0.1:9016", "model": "tiny-model",
|
{"endpoint": "http://127.0.0.1:9016", "model": "tiny-model",
|
||||||
"vram_bytes": 10_000, "ram_bytes": 10_000, "quantizations": ["bfloat16"],
|
"vram_bytes": 10_000, "ram_bytes": 10_000, "quantizations": ["bfloat16"],
|
||||||
|
|||||||
Reference in New Issue
Block a user