rag-sentinel 0.1.3__tar.gz → 0.1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rag_sentinel-0.1.3/src/rag_sentinel.egg-info → rag_sentinel-0.1.4}/PKG-INFO +1 -1
- {rag_sentinel-0.1.3 → rag_sentinel-0.1.4}/pyproject.toml +1 -1
- {rag_sentinel-0.1.3 → rag_sentinel-0.1.4}/src/rag_sentinel/cli.py +44 -7
- {rag_sentinel-0.1.3 → rag_sentinel-0.1.4/src/rag_sentinel.egg-info}/PKG-INFO +1 -1
- {rag_sentinel-0.1.3 → rag_sentinel-0.1.4}/LICENSE +0 -0
- {rag_sentinel-0.1.3 → rag_sentinel-0.1.4}/MANIFEST.in +0 -0
- {rag_sentinel-0.1.3 → rag_sentinel-0.1.4}/README.md +0 -0
- {rag_sentinel-0.1.3 → rag_sentinel-0.1.4}/setup.cfg +0 -0
- {rag_sentinel-0.1.3 → rag_sentinel-0.1.4}/src/rag_sentinel/__init__.py +0 -0
- {rag_sentinel-0.1.3 → rag_sentinel-0.1.4}/src/rag_sentinel/evaluator.py +0 -0
- {rag_sentinel-0.1.3 → rag_sentinel-0.1.4}/src/rag_sentinel/templates/.env.template +0 -0
- {rag_sentinel-0.1.3 → rag_sentinel-0.1.4}/src/rag_sentinel/templates/config.ini.template +0 -0
- {rag_sentinel-0.1.3 → rag_sentinel-0.1.4}/src/rag_sentinel/templates/rag_eval_config.yaml +0 -0
- {rag_sentinel-0.1.3 → rag_sentinel-0.1.4}/src/rag_sentinel.egg-info/SOURCES.txt +0 -0
- {rag_sentinel-0.1.3 → rag_sentinel-0.1.4}/src/rag_sentinel.egg-info/dependency_links.txt +0 -0
- {rag_sentinel-0.1.3 → rag_sentinel-0.1.4}/src/rag_sentinel.egg-info/entry_points.txt +0 -0
- {rag_sentinel-0.1.3 → rag_sentinel-0.1.4}/src/rag_sentinel.egg-info/requires.txt +0 -0
- {rag_sentinel-0.1.3 → rag_sentinel-0.1.4}/src/rag_sentinel.egg-info/top_level.txt +0 -0
|
@@ -20,7 +20,9 @@ import socket
|
|
|
20
20
|
import subprocess
|
|
21
21
|
import time
|
|
22
22
|
import argparse
|
|
23
|
+
import configparser
|
|
23
24
|
from pathlib import Path
|
|
25
|
+
from urllib.parse import urlparse
|
|
24
26
|
|
|
25
27
|
|
|
26
28
|
# =============================================================================
|
|
@@ -34,6 +36,39 @@ TEMPLATES_DIR = Path(__file__).parent / "templates"
|
|
|
34
36
|
# Helper Functions
|
|
35
37
|
# =============================================================================
|
|
36
38
|
|
|
39
|
+
def get_mlflow_host_port():
|
|
40
|
+
"""
|
|
41
|
+
Read MLflow tracking_uri from config.ini and parse host and port.
|
|
42
|
+
|
|
43
|
+
Returns:
|
|
44
|
+
tuple: (host, port) - defaults to ("127.0.0.1", 5001) if not configured
|
|
45
|
+
"""
|
|
46
|
+
default_host = "127.0.0.1"
|
|
47
|
+
default_port = 5000
|
|
48
|
+
|
|
49
|
+
config_path = Path("config.ini")
|
|
50
|
+
if not config_path.exists():
|
|
51
|
+
return default_host, default_port
|
|
52
|
+
|
|
53
|
+
try:
|
|
54
|
+
ini = configparser.ConfigParser()
|
|
55
|
+
ini.read(config_path)
|
|
56
|
+
|
|
57
|
+
tracking_uri = ini.get("mlflow", "tracking_uri", fallback=None)
|
|
58
|
+
if not tracking_uri:
|
|
59
|
+
return default_host, default_port
|
|
60
|
+
|
|
61
|
+
# Parse the URI (e.g., "http://192.168.1.100:5000")
|
|
62
|
+
parsed = urlparse(tracking_uri)
|
|
63
|
+
|
|
64
|
+
host = parsed.hostname or default_host
|
|
65
|
+
port = parsed.port or default_port
|
|
66
|
+
|
|
67
|
+
return host, port
|
|
68
|
+
except Exception:
|
|
69
|
+
return default_host, default_port
|
|
70
|
+
|
|
71
|
+
|
|
37
72
|
def is_port_in_use(host, port):
|
|
38
73
|
"""
|
|
39
74
|
Check if a port is already in use.
|
|
@@ -49,7 +84,7 @@ def is_port_in_use(host, port):
|
|
|
49
84
|
return s.connect_ex((host, port)) == 0
|
|
50
85
|
|
|
51
86
|
|
|
52
|
-
def start_mlflow_server(host
|
|
87
|
+
def start_mlflow_server(host, port):
|
|
53
88
|
"""
|
|
54
89
|
Start MLflow tracking server as a background process.
|
|
55
90
|
|
|
@@ -57,8 +92,8 @@ def start_mlflow_server(host="127.0.0.1", port=5001):
|
|
|
57
92
|
will skip starting a new instance.
|
|
58
93
|
|
|
59
94
|
Args:
|
|
60
|
-
host: The hostname to bind the server to
|
|
61
|
-
port: The port number for the server
|
|
95
|
+
host: The hostname to bind the server to
|
|
96
|
+
port: The port number for the server
|
|
62
97
|
|
|
63
98
|
Returns:
|
|
64
99
|
subprocess.Popen or None: The server process, or None if already running
|
|
@@ -144,8 +179,9 @@ def cmd_run(args):
|
|
|
144
179
|
|
|
145
180
|
This command:
|
|
146
181
|
1. Validates that all required config files exist
|
|
147
|
-
2.
|
|
148
|
-
3.
|
|
182
|
+
2. Reads MLflow host/port from config.ini
|
|
183
|
+
3. Starts MLflow server (unless --no-server is specified)
|
|
184
|
+
4. Runs the evaluation using the evaluator module
|
|
149
185
|
|
|
150
186
|
Args:
|
|
151
187
|
args: Parsed command-line arguments (includes --no-server flag)
|
|
@@ -161,9 +197,10 @@ def cmd_run(args):
|
|
|
161
197
|
print("\nRun 'rag-sentinel init' first to create config files.")
|
|
162
198
|
sys.exit(1)
|
|
163
199
|
|
|
164
|
-
# Start MLflow server if not disabled
|
|
200
|
+
# Start MLflow server if not disabled (uses host/port from config.ini)
|
|
165
201
|
if not args.no_server:
|
|
166
|
-
|
|
202
|
+
host, port = get_mlflow_host_port()
|
|
203
|
+
start_mlflow_server(host, port)
|
|
167
204
|
|
|
168
205
|
# Import and run the evaluation
|
|
169
206
|
from rag_sentinel.evaluator import run_evaluation
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|