mle-kit-mcp 0.1.2__py3-none-any.whl → 0.2.0__py3-none-any.whl
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.
- mle_kit_mcp/tools/llm_proxy.py +3 -5
- mle_kit_mcp/tools/remote_gpu.py +32 -18
- {mle_kit_mcp-0.1.2.dist-info → mle_kit_mcp-0.2.0.dist-info}/METADATA +1 -1
- {mle_kit_mcp-0.1.2.dist-info → mle_kit_mcp-0.2.0.dist-info}/RECORD +8 -8
- {mle_kit_mcp-0.1.2.dist-info → mle_kit_mcp-0.2.0.dist-info}/WHEEL +0 -0
- {mle_kit_mcp-0.1.2.dist-info → mle_kit_mcp-0.2.0.dist-info}/entry_points.txt +0 -0
- {mle_kit_mcp-0.1.2.dist-info → mle_kit_mcp-0.2.0.dist-info}/licenses/LICENSE +0 -0
- {mle_kit_mcp-0.1.2.dist-info → mle_kit_mcp-0.2.0.dist-info}/top_level.txt +0 -0
mle_kit_mcp/tools/llm_proxy.py
CHANGED
@@ -116,7 +116,7 @@ def llm_proxy_remote(port: Optional[int] = None) -> str:
|
|
116
116
|
chosen_port = port or random.randint(5000, 6000)
|
117
117
|
token = secrets.token_urlsafe(24)
|
118
118
|
dependencies_cmd = f"python3 -m pip install -q --no-input {DEPENDENCIES}"
|
119
|
-
_remote_run_command(instance, dependencies_cmd, timeout=300
|
119
|
+
_remote_run_command(instance, dependencies_cmd, timeout=300)
|
120
120
|
|
121
121
|
launch_cmd = (
|
122
122
|
f"OPENROUTER_API_KEY='{api_key}' ACCESS_TOKEN='{token}' "
|
@@ -125,14 +125,12 @@ def llm_proxy_remote(port: Optional[int] = None) -> str:
|
|
125
125
|
f"> openrouter_proxy.log 2>&1 "
|
126
126
|
f"& echo $! > openrouter_proxy.pid"
|
127
127
|
)
|
128
|
-
_remote_run_command(instance, launch_cmd, timeout=60
|
128
|
+
_remote_run_command(instance, launch_cmd, timeout=60)
|
129
129
|
|
130
130
|
health_cmd = f'import httpx; print(httpx.get("http://127.0.0.1:{chosen_port}/health").json())'
|
131
131
|
start_time = time.time()
|
132
132
|
while time.time() - start_time < START_TIMEOUT:
|
133
|
-
result = _remote_run_command(
|
134
|
-
instance, f"python -c '{health_cmd}'", timeout=10, raise_exc=False
|
135
|
-
)
|
133
|
+
result = _remote_run_command(instance, f"python -c '{health_cmd}'", timeout=10)
|
136
134
|
if result.returncode == 0 and "ok" in result.stdout.strip():
|
137
135
|
break
|
138
136
|
time.sleep(1)
|
mle_kit_mcp/tools/remote_gpu.py
CHANGED
@@ -115,7 +115,7 @@ def get_offers(vast_sdk: VastAI, gpu_name: str) -> List[int]:
|
|
115
115
|
|
116
116
|
|
117
117
|
def run_command(
|
118
|
-
instance: InstanceInfo, command: str, timeout: int = 60
|
118
|
+
instance: InstanceInfo, command: str, timeout: int = 60
|
119
119
|
) -> subprocess.CompletedProcess[str]:
|
120
120
|
cmd = [
|
121
121
|
"ssh",
|
@@ -138,16 +138,31 @@ def run_command(
|
|
138
138
|
]
|
139
139
|
try:
|
140
140
|
result = subprocess.run(cmd, capture_output=True, text=True, timeout=timeout)
|
141
|
-
if result.
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
141
|
+
if result.stdout:
|
142
|
+
result.stdout = result.stdout.replace(VAST_AI_GREETING, "").strip()
|
143
|
+
if result.stderr:
|
144
|
+
result.stderr = result.stderr.replace(VAST_AI_GREETING, "").strip()
|
145
|
+
except subprocess.TimeoutExpired as e:
|
146
|
+
output = None
|
147
|
+
if e.stdout:
|
148
|
+
output_message = e.stdout.decode("utf-8").strip()
|
149
|
+
output_message = output_message.replace(VAST_AI_GREETING, "").strip()
|
150
|
+
if output_message:
|
151
|
+
output = output_message
|
152
|
+
error = (
|
149
153
|
f"Command timed out after {timeout} seconds: {command};\n"
|
150
|
-
f"You can increase the timeout by changing the parameter of the tool call
|
154
|
+
f"You can increase the timeout by changing the parameter of the tool call.\n"
|
155
|
+
)
|
156
|
+
if e.stderr:
|
157
|
+
error_message = e.stderr.decode("utf-8").strip()
|
158
|
+
error_message = error_message.replace(VAST_AI_GREETING, "").strip()
|
159
|
+
if error_message:
|
160
|
+
error += f"Original stderr: {error_message}"
|
161
|
+
return subprocess.CompletedProcess(
|
162
|
+
args=cmd,
|
163
|
+
returncode=-9,
|
164
|
+
stdout=output,
|
165
|
+
stderr=error,
|
151
166
|
)
|
152
167
|
return result
|
153
168
|
|
@@ -255,10 +270,9 @@ def launch_instance(vast_sdk: VastAI, gpu_name: str) -> Optional[InstanceInfo]:
|
|
255
270
|
max_attempts = 10
|
256
271
|
is_okay = False
|
257
272
|
for attempt in range(max_attempts):
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
print(f"Waiting for SSH... {e}\n(Attempt {attempt+1}/{max_attempts})")
|
273
|
+
result = run_command(info, "echo 'SSH connection successful'")
|
274
|
+
if result.returncode != 0:
|
275
|
+
print(f"Waiting for SSH... {result.stderr}\n(Attempt {attempt+1}/{max_attempts})")
|
262
276
|
time.sleep(30)
|
263
277
|
continue
|
264
278
|
if "SSH connection successful" in result.stdout:
|
@@ -305,10 +319,10 @@ def remote_bash(command: str, timeout: int = 60) -> str:
|
|
305
319
|
instance = get_instance()
|
306
320
|
assert instance
|
307
321
|
assert timeout
|
308
|
-
result = run_command(instance, command, timeout=timeout
|
309
|
-
output = ("
|
310
|
-
output += ("
|
311
|
-
return output
|
322
|
+
result = run_command(instance, command, timeout=timeout)
|
323
|
+
output = ("Command stdout: " + result.stdout + "\n") if result.stdout else ""
|
324
|
+
output += ("Command stderr: " + result.stderr) if result.stderr else ""
|
325
|
+
return output
|
312
326
|
|
313
327
|
|
314
328
|
def remote_download(file_path: str) -> str:
|
@@ -7,12 +7,12 @@ mle_kit_mcp/server.py,sha256=W4YJ3m1-NKheJ5QlGggfMQyXPghzKgg5zXqb-TLYH1U,1271
|
|
7
7
|
mle_kit_mcp/utils.py,sha256=iHNcEZZzPD37bEYE18SzJ3WUjLP3Ym-kc91SwcW1vlI,1984
|
8
8
|
mle_kit_mcp/tools/__init__.py,sha256=r2fIg2mZ6zaeq0CzEKCEdeUTjV0pcA9NZaaOfBNVTnE,332
|
9
9
|
mle_kit_mcp/tools/bash.py,sha256=kunYHc3dyPGOooT-KY9L7eI_N22lBrcDbTlcp_yTTws,2820
|
10
|
-
mle_kit_mcp/tools/llm_proxy.py,sha256=
|
11
|
-
mle_kit_mcp/tools/remote_gpu.py,sha256=
|
10
|
+
mle_kit_mcp/tools/llm_proxy.py,sha256=RHW-PgxNnq2rs3sLJCA_CHNGt2ar1DYN2U0OlRjvDZ0,5234
|
11
|
+
mle_kit_mcp/tools/remote_gpu.py,sha256=DgfRkMVKn1HYLLboo3nkVIy1qcTlsX4xADQCAHckp_I,12130
|
12
12
|
mle_kit_mcp/tools/text_editor.py,sha256=0uGcSjcBjdPlqjYZYuWo29SmAMzBcWgKt4KRumFI3WE,9529
|
13
|
-
mle_kit_mcp-0.
|
14
|
-
mle_kit_mcp-0.
|
15
|
-
mle_kit_mcp-0.
|
16
|
-
mle_kit_mcp-0.
|
17
|
-
mle_kit_mcp-0.
|
18
|
-
mle_kit_mcp-0.
|
13
|
+
mle_kit_mcp-0.2.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
14
|
+
mle_kit_mcp-0.2.0.dist-info/METADATA,sha256=BbJCb7Y1ep9BIeJk5MpEOEqxSCf3RRd3vBpCqJZDbuM,1074
|
15
|
+
mle_kit_mcp-0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
16
|
+
mle_kit_mcp-0.2.0.dist-info/entry_points.txt,sha256=-iHSUVPN49jkBj1ySpc-P0rVF5-IPHw-KWNayNIiEsk,49
|
17
|
+
mle_kit_mcp-0.2.0.dist-info/top_level.txt,sha256=XeBtCq_CnVI0gh0Z_daZOLmGl5XPlkA8RgHaj5s5VQY,12
|
18
|
+
mle_kit_mcp-0.2.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|