dayhoff-tools 1.3.17__py3-none-any.whl → 1.3.18__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.
@@ -582,8 +582,9 @@ def list_engines(
582
582
  @engine_app.command("status")
583
583
  def engine_status(
584
584
  name_or_id: str = typer.Argument(help="Engine name or instance ID"),
585
+ show_log: bool = typer.Option(False, "--show-log", help="Show bootstrap log"),
585
586
  ):
586
- """Show detailed status of an engine."""
587
+ """Show detailed engine status and information."""
587
588
  check_aws_sso()
588
589
 
589
590
  # Get all engines to resolve name
@@ -655,12 +656,30 @@ def engine_status(
655
656
  f" • {studio['user']} ({studio['studio_id']}) - attached {attach_time}"
656
657
  )
657
658
 
658
- panel = Panel(
659
- "\n".join(status_lines),
660
- title="Engine Details",
661
- border_style="blue",
662
- )
663
- console.print(panel)
659
+ console.print(Panel("\n".join(status_lines), title="Engine Status", border_style="blue"))
660
+
661
+ if show_log:
662
+ console.print("\n[bold]Bootstrap Log:[/bold]")
663
+ try:
664
+ ssm = boto3.client("ssm", region_name="us-east-1")
665
+ resp = ssm.send_command(
666
+ InstanceIds=[engine["instance_id"]],
667
+ DocumentName="AWS-RunShellScript",
668
+ Parameters={"commands": ["cat /var/log/engine-setup.log 2>/dev/null || echo 'No setup log found'"], "executionTimeout": ["15"]},
669
+ )
670
+ cid = resp["Command"]["CommandId"]
671
+ time.sleep(2)
672
+ inv = ssm.get_command_invocation(CommandId=cid, InstanceId=engine["instance_id"])
673
+ if inv["Status"] == "Success":
674
+ log_content = inv["StandardOutputContent"].strip()
675
+ if log_content:
676
+ console.print(f"[dim]{log_content}[/dim]")
677
+ else:
678
+ console.print("[yellow]No bootstrap log available[/yellow]")
679
+ else:
680
+ console.print("[red]❌ Could not retrieve bootstrap log[/red]")
681
+ except Exception as e:
682
+ console.print(f"[red]❌ Error fetching log: {e}[/red]")
664
683
 
665
684
 
666
685
  @engine_app.command("stop")
@@ -2046,3 +2065,56 @@ def idle_timeout_cmd(
2046
2065
  cid = resp["Command"]["CommandId"]
2047
2066
  time.sleep(2)
2048
2067
  console.print(f"[green]✓ Idle timeout updated to {set}[/green]")
2068
+
2069
+ # Add this near the end, after the idle-timeout command
2070
+
2071
+ @engine_app.command("debug")
2072
+ def debug_engine(
2073
+ name_or_id: str = typer.Argument(help="Engine name or instance ID"),
2074
+ ):
2075
+ """Debug engine bootstrap status and files."""
2076
+ check_aws_sso()
2077
+
2078
+ # Resolve engine
2079
+ response = make_api_request("GET", "/engines")
2080
+ if response.status_code != 200:
2081
+ console.print("[red]❌ Failed to fetch engines[/red]")
2082
+ raise typer.Exit(1)
2083
+
2084
+ engines = response.json().get("engines", [])
2085
+ engine = resolve_engine(name_or_id, engines)
2086
+
2087
+ console.print(f"[bold]Debug info for {engine['name']}:[/bold]\n")
2088
+
2089
+ ssm = boto3.client("ssm", region_name="us-east-1")
2090
+
2091
+ # Check multiple files and systemd status
2092
+ checks = [
2093
+ ("Stage file", "cat /var/run/engine-init.stage 2>/dev/null || echo 'MISSING'"),
2094
+ ("Health file", "cat /var/run/engine-health.json 2>/dev/null || echo 'MISSING'"),
2095
+ ("Sentinel file", "ls -la /opt/dayhoff/first_boot_complete.sentinel 2>/dev/null || echo 'MISSING'"),
2096
+ ("Setup service", "systemctl status setup-aws-vm.service --no-pager || echo 'Service not found'"),
2097
+ ("Bootstrap log tail", "tail -20 /var/log/engine-setup.log 2>/dev/null || echo 'No log'"),
2098
+ ("Environment file", "cat /etc/engine.env 2>/dev/null || echo 'MISSING'"),
2099
+ ]
2100
+
2101
+ for name, cmd in checks:
2102
+ try:
2103
+ resp = ssm.send_command(
2104
+ InstanceIds=[engine["instance_id"]],
2105
+ DocumentName="AWS-RunShellScript",
2106
+ Parameters={"commands": [cmd], "executionTimeout": ["10"]},
2107
+ )
2108
+ cid = resp["Command"]["CommandId"]
2109
+ time.sleep(1)
2110
+ inv = ssm.get_command_invocation(CommandId=cid, InstanceId=engine["instance_id"])
2111
+
2112
+ if inv["Status"] == "Success":
2113
+ output = inv["StandardOutputContent"].strip()
2114
+ console.print(f"[cyan]{name}:[/cyan]")
2115
+ console.print(f"[dim]{output}[/dim]\n")
2116
+ else:
2117
+ console.print(f"[cyan]{name}:[/cyan] [red]FAILED[/red]\n")
2118
+
2119
+ except Exception as e:
2120
+ console.print(f"[cyan]{name}:[/cyan] [red]ERROR: {e}[/red]\n")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: dayhoff-tools
3
- Version: 1.3.17
3
+ Version: 1.3.18
4
4
  Summary: Common tools for all the repos at Dayhoff Labs
5
5
  Author: Daniel Martin-Alarcon
6
6
  Author-email: dma@dayhofflabs.com
@@ -3,7 +3,7 @@ dayhoff_tools/chemistry/standardizer.py,sha256=uMn7VwHnx02nc404eO6fRuS4rsl4dvSPf
3
3
  dayhoff_tools/chemistry/utils.py,sha256=jt-7JgF-GeeVC421acX-bobKbLU_X94KNOW24p_P-_M,2257
4
4
  dayhoff_tools/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  dayhoff_tools/cli/cloud_commands.py,sha256=33qcWLmq-FwEXMdL3F0OHm-5Stlh2r65CldyEZgQ1no,40904
6
- dayhoff_tools/cli/engine_commands.py,sha256=DlWw8oUzOJqN6uUgsxF5whfY8jfwvBko8hvRm3ZHxVc,75814
6
+ dayhoff_tools/cli/engine_commands.py,sha256=4Z00VAwAaZKv0z1cXimH_JF6UKgGnX4rUawLxfFf8Zs,79197
7
7
  dayhoff_tools/cli/main.py,sha256=rgeEHD9lJ8SBCR34BTLb7gVInHUUdmEBNXAJnq5yEU4,4795
8
8
  dayhoff_tools/cli/swarm_commands.py,sha256=5EyKj8yietvT5lfoz8Zx0iQvVaNgc3SJX1z2zQR6o6M,5614
9
9
  dayhoff_tools/cli/utility_commands.py,sha256=qs8vH9TBFHsOPC3X8cU3qZigM3dDn-2Ytq4o_F2WubU,27874
@@ -27,7 +27,7 @@ dayhoff_tools/intake/uniprot.py,sha256=BZYJQF63OtPcBBnQ7_P9gulxzJtqyorgyuDiPeOJq
27
27
  dayhoff_tools/logs.py,sha256=DKdeP0k0kliRcilwvX0mUB2eipO5BdWUeHwh-VnsICs,838
28
28
  dayhoff_tools/sqlite.py,sha256=jV55ikF8VpTfeQqqlHSbY8OgfyfHj8zgHNpZjBLos_E,18672
29
29
  dayhoff_tools/warehouse.py,sha256=8YbnQ--usrEgDQGfvpV4MrMji55A0rq2hZaOgFGh6ag,15896
30
- dayhoff_tools-1.3.17.dist-info/METADATA,sha256=69jNn8FqivgUWrwrLZ9S-ZEherpCtEHUrBABW5dewWs,2825
31
- dayhoff_tools-1.3.17.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
32
- dayhoff_tools-1.3.17.dist-info/entry_points.txt,sha256=iAf4jteNqW3cJm6CO6czLxjW3vxYKsyGLZ8WGmxamSc,49
33
- dayhoff_tools-1.3.17.dist-info/RECORD,,
30
+ dayhoff_tools-1.3.18.dist-info/METADATA,sha256=hQN8_0h-PnFGTHJw8p775acWefGqk3y1klZuUkhmJO8,2825
31
+ dayhoff_tools-1.3.18.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
32
+ dayhoff_tools-1.3.18.dist-info/entry_points.txt,sha256=iAf4jteNqW3cJm6CO6czLxjW3vxYKsyGLZ8WGmxamSc,49
33
+ dayhoff_tools-1.3.18.dist-info/RECORD,,