request-vm-on-golem 0.1.48__py3-none-any.whl → 0.1.50__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: request-vm-on-golem
3
- Version: 0.1.48
3
+ Version: 0.1.50
4
4
  Summary: VM on Golem Requestor CLI - Create and manage virtual machines on the Golem Network
5
5
  Keywords: golem,vm,cloud,decentralized,cli
6
6
  Author: Phillip Jensen
@@ -1,7 +1,7 @@
1
1
  requestor/__init__.py,sha256=OqSUAh1uZBMx7GW0MoSMg967PVdmT8XdPJx3QYjwkak,116
2
2
  requestor/api/main.py,sha256=7utCzFNbh5Ol-vsBWeSwT4lXeHD7zdA-GFZuS3rHMWc,2180
3
3
  requestor/cli/__init__.py,sha256=e3E4oEGxmGj-STPtFkQwg_qIWhR0JAiAQdw3G1hXciU,37
4
- requestor/cli/commands.py,sha256=k2UNXNLlxFUq36IeU_VQVxrhp5sQkHW1EW-f8RtzXPY,42591
4
+ requestor/cli/commands.py,sha256=JfDvDYNvji1uIUF-0fHEHZxLzHWl-NslBdG1Yw2sFuY,45748
5
5
  requestor/config.py,sha256=2ayNJzvIIoU0jMAVqbs-yfG4H63W_uALLScBG4EjUOw,8241
6
6
  requestor/data/deployments/l2.json,sha256=XTNN2C5LkBfp4YbDKdUKfWMdp1fKnfv8D3TgcwVWxtQ,249
7
7
  requestor/db/__init__.py,sha256=Gm5DfWls6uvCZZ3HGGnyRHswbUQdeA5OGN8yPwH0hc8,88
@@ -21,7 +21,7 @@ requestor/ssh/__init__.py,sha256=hNgSqJ5s1_AwwxVRyFjUqh_LTBpI4Hmzq0F-f_wXN9g,119
21
21
  requestor/ssh/manager.py,sha256=3jQtbbK7CVC2yD1zCO88jGXh2fBcuv3CzWEqDLuaQVk,9758
22
22
  requestor/utils/logging.py,sha256=oFNpO8pJboYM8Wp7g3HOU4HFyBTKypVdY15lUiz1a4I,3721
23
23
  requestor/utils/spinner.py,sha256=PUHJdTD9jpUHur__01_qxXy87WFfNmjQbD_sLG-KlGo,2459
24
- request_vm_on_golem-0.1.48.dist-info/METADATA,sha256=8ot29t_IxGHPYulMIMs94Z23kUVMTbRDmWpM9S7y7Tk,14363
25
- request_vm_on_golem-0.1.48.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
26
- request_vm_on_golem-0.1.48.dist-info/entry_points.txt,sha256=Z-skRNpJ8aZcIl_En9mEm1ygkp9FKy0bzQoL3zO52-0,44
27
- request_vm_on_golem-0.1.48.dist-info/RECORD,,
24
+ request_vm_on_golem-0.1.50.dist-info/METADATA,sha256=EWV0bEfyWQeyBldHWHx3nUgOmZmD_5b5K6Btyp6VQt4,14363
25
+ request_vm_on_golem-0.1.50.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
26
+ request_vm_on_golem-0.1.50.dist-info/entry_points.txt,sha256=Z-skRNpJ8aZcIl_En9mEm1ygkp9FKy0bzQoL3zO52-0,44
27
+ request_vm_on_golem-0.1.50.dist-info/RECORD,,
requestor/cli/commands.py CHANGED
@@ -340,6 +340,90 @@ def vm_stream():
340
340
  pass
341
341
 
342
342
 
343
+ @vm_stream.command('list')
344
+ @click.option('--json', 'as_json', is_flag=True, help='Output in JSON format')
345
+ @async_command
346
+ async def stream_list(as_json: bool):
347
+ """List payment stream status for all known VMs."""
348
+ try:
349
+ vms = await db_service.list_vms()
350
+ if not vms:
351
+ logger.warning("No VMs found in local database")
352
+ click.echo(json.dumps({"streams": []}, indent=2) if as_json else "No VMs found.")
353
+ return {"streams": []}
354
+
355
+ results = []
356
+ for vm in vms:
357
+ item: dict = {
358
+ "name": vm.get("name"),
359
+ "provider_ip": vm.get("provider_ip"),
360
+ "stream_id": None,
361
+ "verified": False,
362
+ "reason": None,
363
+ "computed": {},
364
+ "error": None,
365
+ }
366
+ try:
367
+ provider_url = config.get_provider_url(vm['provider_ip'])
368
+ async with ProviderClient(provider_url) as client:
369
+ status = await client.get_vm_stream_status(vm['vm_id'])
370
+ item.update({
371
+ "stream_id": status.get("stream_id"),
372
+ "verified": bool(status.get("verified")),
373
+ "reason": status.get("reason"),
374
+ "computed": status.get("computed", {}),
375
+ })
376
+ except Exception as e:
377
+ msg = str(e)
378
+ # Normalize common provider errors
379
+ if "no stream mapped" in msg.lower():
380
+ item.update({
381
+ "stream_id": None,
382
+ "verified": False,
383
+ "reason": "unmapped",
384
+ })
385
+ else:
386
+ item["error"] = msg
387
+ results.append(item)
388
+
389
+ out = {"streams": results}
390
+
391
+ if as_json:
392
+ click.echo(json.dumps(out, indent=2))
393
+ else:
394
+ # Render a concise table
395
+ headers = [
396
+ "VM",
397
+ "Stream ID",
398
+ "Verified",
399
+ "Reason",
400
+ "Remaining (s)",
401
+ "Withdrawable (wei)",
402
+ ]
403
+ rows = []
404
+ for r in results:
405
+ comp = r.get("computed") or {}
406
+ rows.append([
407
+ r.get("name"),
408
+ r.get("stream_id") if r.get("stream_id") is not None else "—",
409
+ "✔" if r.get("verified") else "✖",
410
+ r.get("reason") or ("error: " + r.get("error") if r.get("error") else ""),
411
+ comp.get("remaining_seconds", ""),
412
+ comp.get("withdrawable_wei", ""),
413
+ ])
414
+ click.echo("\n" + "─" * 60)
415
+ click.echo(click.style(f" 💸 Streams ({len(results)} VMs)", fg="blue", bold=True))
416
+ click.echo("─" * 60)
417
+ click.echo("\n" + tabulate(rows, headers=[click.style(h, bold=True) for h in headers], tablefmt="grid"))
418
+ click.echo("\n" + "─" * 60)
419
+
420
+ return out
421
+
422
+ except Exception as e:
423
+ logger.error(f"Failed to list streams: {e}")
424
+ raise click.Abort()
425
+
426
+
343
427
  @vm_stream.command('open')
344
428
  @click.option('--provider-id', required=True, help='Provider ID to use')
345
429
  @click.option('--cpu', type=int, required=True, help='CPU cores for rate calc')