hte-cli 0.2.0__py3-none-any.whl → 0.2.1__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.
hte_cli/cli.py
CHANGED
|
@@ -217,8 +217,10 @@ def session_join(ctx, session_id: str, force_setup: bool):
|
|
|
217
217
|
console.print()
|
|
218
218
|
|
|
219
219
|
# Import runner components
|
|
220
|
+
import time
|
|
220
221
|
from hte_cli.events import EventStreamer
|
|
221
|
-
from hte_cli.runner import TaskRunner
|
|
222
|
+
from hte_cli.runner import TaskRunner
|
|
223
|
+
from hte_cli.image_utils import extract_images_from_compose, pull_image_with_progress
|
|
222
224
|
|
|
223
225
|
# Create event streamer
|
|
224
226
|
events = EventStreamer(api, session_id)
|
|
@@ -264,48 +266,45 @@ def session_join(ctx, session_id: str, force_setup: bool):
|
|
|
264
266
|
# Build assignment dict for runner compatibility
|
|
265
267
|
assignment = {
|
|
266
268
|
"assignment_id": session_info.get("assignment_id"),
|
|
269
|
+
"session_id": session_id,
|
|
267
270
|
"task_id": session_info["task_id"],
|
|
268
271
|
"benchmark": session_info["benchmark"],
|
|
269
272
|
"mode": session_info["mode"],
|
|
270
273
|
"time_cap_seconds": session_info.get("time_cap_seconds"),
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
"scorer_type": session_info.get("scorer_type"),
|
|
278
|
-
"intermediate_scoring": session_info.get("intermediate_scoring", False),
|
|
274
|
+
"task": {
|
|
275
|
+
"instructions": session_info.get("instructions", ""),
|
|
276
|
+
"metadata": session_info.get("metadata", {}),
|
|
277
|
+
"scorer_type": session_info.get("scorer_type"),
|
|
278
|
+
"intermediate_scoring": session_info.get("intermediate_scoring", False),
|
|
279
|
+
},
|
|
279
280
|
}
|
|
280
281
|
|
|
281
282
|
# Step 3: Run setup (skip if reconnecting without force)
|
|
283
|
+
setup_start_time = time.monotonic()
|
|
282
284
|
if not is_reconnect or force_setup:
|
|
283
285
|
# Send setup_started event
|
|
284
286
|
events.setup_started({"cli_version": __version__, "task_id": assignment["task_id"]})
|
|
285
287
|
|
|
286
|
-
#
|
|
287
|
-
runner = TaskRunner(session_id, api, events, console)
|
|
288
|
-
compose_manager = None
|
|
289
|
-
|
|
288
|
+
# Pull images if we have compose
|
|
290
289
|
if compose_yaml:
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
compose_manager.up()
|
|
290
|
+
images = extract_images_from_compose(compose_yaml)
|
|
291
|
+
if images:
|
|
292
|
+
console.print(f"[bold]Pulling {len(images)} Docker image(s)...[/bold]")
|
|
293
|
+
events.image_pull_started({})
|
|
294
|
+
for img in images:
|
|
295
|
+
short_name = img.split("/")[-1][:40]
|
|
296
|
+
with console.status(f"[yellow]↓[/yellow] {short_name}") as status:
|
|
297
|
+
success = pull_image_with_progress(img)
|
|
298
|
+
if success:
|
|
299
|
+
console.print(f" [green]✓[/green] {short_name}")
|
|
300
|
+
else:
|
|
301
|
+
console.print(f" [red]✗[/red] {short_name} (failed)")
|
|
302
|
+
events.image_pull_completed({})
|
|
303
|
+
console.print()
|
|
306
304
|
|
|
307
305
|
# Send setup_completed - THIS STARTS THE TIMER ON SERVER
|
|
308
|
-
|
|
306
|
+
total_setup = time.monotonic() - setup_start_time
|
|
307
|
+
events.setup_completed(total_seconds=total_setup)
|
|
309
308
|
console.print("[green]Environment ready! Timer started.[/green]")
|
|
310
309
|
console.print()
|
|
311
310
|
else:
|
|
@@ -318,19 +317,37 @@ def session_join(ctx, session_id: str, force_setup: bool):
|
|
|
318
317
|
console.print(Panel(session_info["instructions"], title="Task Instructions"))
|
|
319
318
|
console.print()
|
|
320
319
|
|
|
321
|
-
# Step 5: Run the task
|
|
322
|
-
|
|
320
|
+
# Step 5: Run the task using TaskRunner
|
|
321
|
+
console.print("[bold]Starting task environment...[/bold]")
|
|
322
|
+
console.print("[dim]Launching Docker containers...[/dim]")
|
|
323
|
+
console.print()
|
|
324
|
+
|
|
325
|
+
events.docker_started()
|
|
326
|
+
|
|
327
|
+
runner = TaskRunner()
|
|
328
|
+
eval_log_bytes = None
|
|
323
329
|
try:
|
|
324
|
-
result = runner.
|
|
330
|
+
result = runner.run_from_assignment(
|
|
325
331
|
assignment=assignment,
|
|
326
|
-
task=task_data,
|
|
327
332
|
compose_yaml=compose_yaml,
|
|
328
333
|
files_zip=files_zip,
|
|
329
334
|
)
|
|
335
|
+
# Read eval log before cleanup
|
|
336
|
+
if result.eval_log_path and result.eval_log_path.exists():
|
|
337
|
+
eval_log_bytes = result.eval_log_path.read_bytes()
|
|
330
338
|
except KeyboardInterrupt:
|
|
339
|
+
events.docker_stopped(exit_code=130)
|
|
331
340
|
console.print()
|
|
332
341
|
console.print("[yellow]Interrupted. Session remains active - you can reconnect later.[/yellow]")
|
|
333
342
|
sys.exit(0)
|
|
343
|
+
except Exception as e:
|
|
344
|
+
events.docker_stopped(exit_code=1)
|
|
345
|
+
console.print(f"[red]Task execution failed: {e}[/red]")
|
|
346
|
+
sys.exit(1)
|
|
347
|
+
finally:
|
|
348
|
+
runner.cleanup()
|
|
349
|
+
|
|
350
|
+
events.docker_stopped(exit_code=0)
|
|
334
351
|
|
|
335
352
|
# Step 6: Upload result
|
|
336
353
|
if result and result.answer:
|
|
@@ -356,7 +373,7 @@ def session_join(ctx, session_id: str, force_setup: bool):
|
|
|
356
373
|
session_id=session_id,
|
|
357
374
|
answer=result.answer or "",
|
|
358
375
|
client_active_seconds=result.time_seconds,
|
|
359
|
-
eval_log_bytes=
|
|
376
|
+
eval_log_bytes=eval_log_bytes,
|
|
360
377
|
score=result.score,
|
|
361
378
|
score_binarized=result.score_binarized,
|
|
362
379
|
agent_id=result.agent_id,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
hte_cli/__init__.py,sha256=fDGXp-r8bIoLtlQnn5xJ_CpwMhonvk9bGjZQsjA2mDI,914
|
|
2
2
|
hte_cli/__main__.py,sha256=63n0gNGfskidWDU0aAIF2N8lylVCLYKVIkrN9QiORoo,107
|
|
3
3
|
hte_cli/api_client.py,sha256=m42kfFZS72Nu_VuDwxRsLNy4ziCcvgk7KNWBh9gwqy0,9257
|
|
4
|
-
hte_cli/cli.py,sha256=
|
|
4
|
+
hte_cli/cli.py,sha256=ppVNUPxQVen3R90UVkA33Cy35N7Un5sh42ml0dPz9nw,39368
|
|
5
5
|
hte_cli/config.py,sha256=42Xv__YMSeRLs2zhGukJkIXFKtnBtYCHnONfViGyt2g,3387
|
|
6
6
|
hte_cli/errors.py,sha256=1J5PpxcUKBu6XjigMMCPOq4Zc12tnv8LhAsiaVFWLQM,2762
|
|
7
7
|
hte_cli/events.py,sha256=Zn-mroqaLHNzdT4DFf8st1Qclglshihdc09dBfCN070,5522
|
|
@@ -9,7 +9,7 @@ hte_cli/image_utils.py,sha256=454yoZEI1duNYrZC8UjhfZzDRP4Nxdrf2TvnZ_54G1k,4439
|
|
|
9
9
|
hte_cli/runner.py,sha256=DhC8FMjHwfLR193iP4thLDRZrNssYA9KH1WYKU2JKeg,13535
|
|
10
10
|
hte_cli/scorers.py,sha256=sFoPJePRt-K191-Ga4cVmrldruJclYXTOLkU_C9nCDI,6025
|
|
11
11
|
hte_cli/version_check.py,sha256=WVZyGy2XfAghQYdd2N9-0Qfg-7pgp9gt4761-PnmacI,1708
|
|
12
|
-
hte_cli-0.2.
|
|
13
|
-
hte_cli-0.2.
|
|
14
|
-
hte_cli-0.2.
|
|
15
|
-
hte_cli-0.2.
|
|
12
|
+
hte_cli-0.2.1.dist-info/METADATA,sha256=r2fEYVYX0wHf-S2pD7ysYt-Ln8Js9wfulcl4RgTWob4,3767
|
|
13
|
+
hte_cli-0.2.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
14
|
+
hte_cli-0.2.1.dist-info/entry_points.txt,sha256=XbyEEi1H14DFAt0Kdl22e_IRVEGzimSzYSh5HlhKlFA,41
|
|
15
|
+
hte_cli-0.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|