hexaqueue-cli 0.9.1__tar.gz → 0.11.0__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.
Files changed (31) hide show
  1. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/PKG-INFO +1 -1
  2. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/pyproject.toml +1 -1
  3. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/pyproject.toml.orig +1 -1
  4. hexaqueue_cli-0.11.0/src/hexaqueue_cli/adapters/oci_pool.py +99 -0
  5. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/commands/cluster.py +189 -0
  6. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/commands/node.py +54 -3
  7. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/README.md +0 -0
  8. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/__init__.py +0 -0
  9. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/adapters/__init__.py +0 -0
  10. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/adapters/local.py +0 -0
  11. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/adapters/presenter.py +0 -0
  12. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/commands/__init__.py +0 -0
  13. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/commands/admin.py +0 -0
  14. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/commands/collateral.py +0 -0
  15. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/commands/mcp.py +0 -0
  16. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/commands/run.py +0 -0
  17. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/commands/scanner.py +0 -0
  18. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/commands/server.py +0 -0
  19. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/commands/suite.py +0 -0
  20. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/commands/workflow.py +0 -0
  21. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/domain/__init__.py +0 -0
  22. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/domain/models.py +0 -0
  23. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/domain/options.py +0 -0
  24. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/domain/parser.py +0 -0
  25. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/domain/session.py +0 -0
  26. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/infra/__init__.py +0 -0
  27. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/infra/bootstrap.py +0 -0
  28. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/infra/options.py +0 -0
  29. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/main.py +0 -0
  30. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/ports/__init__.py +0 -0
  31. {hexaqueue_cli-0.9.1 → hexaqueue_cli-0.11.0}/src/hexaqueue_cli/ports/client.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hexaqueue-cli
3
- Version: 0.9.1
3
+ Version: 0.11.0
4
4
  Summary: Hexaqueue CLI - Modern developer and operator terminal interface
5
5
  Author: Richard West
6
6
  Author-email: Richard West <dopplereffect.us@gmail.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "hexaqueue-cli"
3
- version = "0.9.1"
3
+ version = "0.11.0"
4
4
  description = "Hexaqueue CLI - Modern developer and operator terminal interface"
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "hexaqueue-cli"
3
- version = "0.9.1"
3
+ version = "0.11.0"
4
4
  description = "Hexaqueue CLI - Modern developer and operator terminal interface"
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
@@ -0,0 +1,99 @@
1
+ """OCI compute worker pool inspection adapter.
2
+
3
+ Notes/Architectural Intent:
4
+ Queries OCI Compute Management and Virtual Network APIs using Instance Principals
5
+ or local configuration to display current pool scaling status, instance states,
6
+ and private IP addresses.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import os
12
+ import sys
13
+
14
+ DEFAULT_POOL_ID = "ocid1.instancepool.oc1.phx.aaaaaaaanrsntnef3gyouosagtedgyjj25h6oyr2cmuufzjsw7h3xaiapi5q"
15
+
16
+
17
+ def inspect_pool(pool_id: str | None = None) -> int:
18
+ """Inspect and display OCI instance pool details and instance states.
19
+
20
+ Args:
21
+ pool_id: Optional OCI instance pool OCID. Defaults to env HEXAQUEUE_OCI_INSTANCE_POOL_ID.
22
+
23
+ Returns:
24
+ Exit code: 0 on success, non-zero on failure.
25
+ """
26
+ target_pool_id = (
27
+ pool_id or os.environ.get("HEXAQUEUE_OCI_INSTANCE_POOL_ID") or DEFAULT_POOL_ID
28
+ )
29
+
30
+ try:
31
+ import oci
32
+ except ImportError:
33
+ sys.stderr.write(
34
+ "Error: 'oci' Python SDK is not installed. Install via 'uv pip install oci'\n"
35
+ )
36
+ return 1
37
+
38
+ try:
39
+ try:
40
+ signer = oci.auth.signers.InstancePrincipalsSecurityTokenSigner()
41
+ config: dict[str, str] = {}
42
+ except Exception:
43
+ config = oci.config.from_file()
44
+ signer = oci.signer.Signer(
45
+ tenancy=config["tenancy"],
46
+ user=config["user"],
47
+ fingerprint=config["fingerprint"],
48
+ private_key_file_location=config.get("key_file"),
49
+ )
50
+
51
+ mgmt_client = oci.core.ComputeManagementClient(config=config, signer=signer)
52
+ net_client = oci.core.VirtualNetworkClient(config=config, signer=signer)
53
+ compute_client = oci.core.ComputeClient(config=config, signer=signer)
54
+
55
+ pool = mgmt_client.get_instance_pool(target_pool_id).data
56
+ print(f"Instance Pool: {pool.display_name} ({pool.id})")
57
+ print(f"Status: {pool.lifecycle_state}")
58
+ print(f"Target Size: {pool.size}")
59
+ print("-" * 75)
60
+
61
+ instances = mgmt_client.list_instance_pool_instances(
62
+ compartment_id=pool.compartment_id,
63
+ instance_pool_id=target_pool_id,
64
+ ).data
65
+
66
+ header = f"{'Instance Name':<30} {'State':<12} {'Private IP':<16} {'OCID Suffix':<15}"
67
+ print(header)
68
+ print("=" * len(header))
69
+
70
+ for inst in instances:
71
+ private_ip = "pending"
72
+ try:
73
+ vnics = compute_client.list_vnic_attachments(
74
+ compartment_id=pool.compartment_id,
75
+ instance_id=inst.id,
76
+ ).data
77
+ if vnics:
78
+ vnic_data = net_client.get_vnic(vnics[0].vnic_id).data
79
+ private_ip = vnic_data.private_ip or "pending"
80
+ except Exception:
81
+ pass
82
+
83
+ display_name = getattr(inst, "display_name", inst.id[-20:])
84
+ ocid_suffix = f"...{inst.id[-12:]}"
85
+ print(
86
+ f"{display_name:<30} {inst.state:<12} {private_ip:<16} {ocid_suffix:<15}"
87
+ )
88
+
89
+ return 0
90
+
91
+ except Exception as exc:
92
+ sys.stderr.write(f"Error querying OCI instance pool: {exc}\n")
93
+ return 2
94
+
95
+
96
+ __all__ = [
97
+ "DEFAULT_POOL_ID",
98
+ "inspect_pool",
99
+ ]
@@ -26,6 +26,7 @@ from rich.console import Console
26
26
  from rich.panel import Panel
27
27
  from rich.table import Table
28
28
 
29
+ from hexaqueue_cli.adapters.oci_pool import inspect_pool
29
30
  from hexaqueue_cli.infra.options import format_option, resolve_format
30
31
  from hexaqueue_core.domain.credentials import discover_and_merge_env
31
32
  from hexaqueue_core.domain.runner_config import (
@@ -477,6 +478,55 @@ def _resolve_tunnel_target(
477
478
  return target_host, target_user, target_key, target_ssh_port, target_remote_port
478
479
 
479
480
 
481
+ def _resolve_admin_target(
482
+ profile: str | None,
483
+ host: str | None,
484
+ user: str | None,
485
+ key: str | None,
486
+ ) -> tuple[str, str, str | None]:
487
+ """Resolve administrative SSH target parameters from CLI flags, profile, or env.
488
+
489
+ Args:
490
+ profile: Runner profile specifying target host and keys.
491
+ host: Target remote cluster host IP or hostname.
492
+ user: Administrative SSH login user.
493
+ key: Path to SSH private key identity file.
494
+
495
+ Returns:
496
+ Tuple of (target_host, target_user, target_key).
497
+
498
+ Raises:
499
+ typer.Exit: If target host cannot be resolved.
500
+ """
501
+ proj_cfg = load_project_config()
502
+ resolved = resolve_runner_config(project_config=proj_cfg, profile=profile)
503
+ env = discover_and_merge_env()
504
+
505
+ target_host = host or resolved.host or env.get("HEXAQUEUE_CLUSTER_HOST")
506
+ target_user = (
507
+ user
508
+ or env.get("HEXAQUEUE_ADMIN_USER")
509
+ or getattr(resolved, "admin_user", None)
510
+ or "ubuntu"
511
+ )
512
+ target_key = key or resolved.ssh_key or env.get("HEXAQUEUE_SSH_KEY")
513
+
514
+ if not target_host:
515
+ discovered = _auto_select_online_host()
516
+ if discovered:
517
+ target_host = discovered["host"]
518
+ target_key = target_key or discovered.get("key")
519
+
520
+ if not target_host:
521
+ console.print(
522
+ "[bold red]Error:[/] Target host not specified. Provide --host, specify host in "
523
+ f"profile '{profile or 'default'}', or export HEXAQUEUE_CLUSTER_HOST."
524
+ )
525
+ raise typer.Exit(code=1)
526
+
527
+ return target_host, target_user, target_key
528
+
529
+
480
530
  @app.command("tunnel")
481
531
  def tunnel_cmd(
482
532
  profile: str | None = typer.Option(
@@ -973,10 +1023,149 @@ def discover_cmd(
973
1023
  _render_discovered_table(probed)
974
1024
 
975
1025
 
1026
+ @app.command("journal")
1027
+ def journal_cmd(
1028
+ profile: str | None = typer.Option(
1029
+ None, "--profile", "-p", help="Runner profile specifying target host and keys"
1030
+ ),
1031
+ host: str | None = typer.Option(
1032
+ None, "--host", "-h", help="Target remote cluster host IP or hostname"
1033
+ ),
1034
+ user: str | None = typer.Option(
1035
+ None, "--user", "-u", help="SSH login user (administrative, default: ubuntu)"
1036
+ ),
1037
+ key: str | None = typer.Option(
1038
+ None, "--key", "-i", help="Path to SSH private key identity file"
1039
+ ),
1040
+ lines: int = typer.Option(
1041
+ 50, "-n", "--lines", help="Number of journal log lines to display"
1042
+ ),
1043
+ follow: bool = typer.Option(
1044
+ True, "-f/--no-follow", help="Continuously follow journal stream"
1045
+ ),
1046
+ ) -> None:
1047
+ """Stream systemd journal logs from the Hexaqueue controller daemon over SSH.
1048
+
1049
+ Args:
1050
+ profile: Runner profile specifying target host and keys.
1051
+ host: Target remote cluster host IP or hostname.
1052
+ user: Administrative SSH user.
1053
+ key: Path to SSH private key identity file.
1054
+ lines: Historical lines to fetch.
1055
+ follow: Whether to follow logs in real time.
1056
+
1057
+ Notes/Architectural Intent:
1058
+ Enables rapid debugging of host-level daemon failures, systemd restarts,
1059
+ and unhandled controller exceptions directly through the hq CLI.
1060
+ """
1061
+ target_host, target_user, target_key = _resolve_admin_target(
1062
+ profile=profile, host=host, user=user, key=key
1063
+ )
1064
+ follow_flag = "-f" if follow else ""
1065
+ remote_cmd = (
1066
+ f"sudo journalctl -u hexaqueue.service -n {lines} {follow_flag} --no-pager"
1067
+ )
1068
+
1069
+ ssh_cmd = [
1070
+ "ssh",
1071
+ "-t",
1072
+ "-o",
1073
+ "StrictHostKeyChecking=accept-new",
1074
+ ]
1075
+ if target_key:
1076
+ key_path = Path(target_key).expanduser()
1077
+ if key_path.exists():
1078
+ ssh_cmd.extend(["-i", str(key_path)])
1079
+ ssh_cmd.extend([f"{target_user}@{target_host}", remote_cmd])
1080
+
1081
+ console.print(f"[dim]Tailing journal logs on {target_user}@{target_host}...[/]")
1082
+ try:
1083
+ proc = subprocess.run(ssh_cmd, check=False)
1084
+ if proc.returncode != 0:
1085
+ raise typer.Exit(code=proc.returncode)
1086
+ except KeyboardInterrupt:
1087
+ return
1088
+
1089
+
1090
+ @app.command("pool")
1091
+ def pool_cmd(
1092
+ profile: str | None = typer.Option(
1093
+ None, "--profile", "-p", help="Runner profile specifying target host and keys"
1094
+ ),
1095
+ host: str | None = typer.Option(
1096
+ None, "--host", "-h", help="Target remote cluster host IP or hostname"
1097
+ ),
1098
+ user: str | None = typer.Option(
1099
+ None, "--user", "-u", help="SSH login user (administrative, default: ubuntu)"
1100
+ ),
1101
+ pool_id: str | None = typer.Option(
1102
+ None, "--pool-id", help="Explicit OCI instance pool OCID override"
1103
+ ),
1104
+ local: bool = typer.Option(
1105
+ False,
1106
+ "--local",
1107
+ help="Query local OCI SDK instead of delegating to remote host via SSH",
1108
+ ),
1109
+ format_type: str = format_option(),
1110
+ ) -> None:
1111
+ """Inspect cloud compute worker pool scaling status and instance health.
1112
+
1113
+ Args:
1114
+ profile: Runner profile specifying target host and keys.
1115
+ host: Target remote cluster host IP or hostname.
1116
+ user: Administrative SSH user.
1117
+ pool_id: Explicit cloud instance pool identifier override.
1118
+ local: Whether to execute pool inspection locally.
1119
+ format_type: Chosen serialization output format.
1120
+
1121
+ Notes/Architectural Intent:
1122
+ Exposes low-level CSP instance pool elasticity, pending instance boots,
1123
+ and private IP topology directly through the unified hq CLI.
1124
+ """
1125
+ if local:
1126
+ code = inspect_pool(pool_id)
1127
+ if code != 0:
1128
+ raise typer.Exit(code=code)
1129
+ return
1130
+
1131
+ target_host, target_user, target_key = _resolve_admin_target(
1132
+ profile=profile, host=host, user=user, key=None
1133
+ )
1134
+
1135
+ pool_arg = f" --pool-id {pool_id}" if pool_id else ""
1136
+ remote_cmd = (
1137
+ "cd /home/ubuntu/hexaqueue && "
1138
+ f"/home/ubuntu/.local/bin/uv run hq cluster pool --local{pool_arg}"
1139
+ )
1140
+
1141
+ ssh_cmd = [
1142
+ "ssh",
1143
+ "-o",
1144
+ "StrictHostKeyChecking=accept-new",
1145
+ ]
1146
+ if target_key:
1147
+ key_path = Path(target_key).expanduser()
1148
+ if key_path.exists():
1149
+ ssh_cmd.extend(["-i", str(key_path)])
1150
+ ssh_cmd.extend([f"{target_user}@{target_host}", remote_cmd])
1151
+
1152
+ console.print(
1153
+ f"[dim]Querying OCI instance pool via {target_user}@{target_host}...[/]"
1154
+ )
1155
+ try:
1156
+ proc = subprocess.run(ssh_cmd, check=False)
1157
+ if proc.returncode != 0:
1158
+ raise typer.Exit(code=proc.returncode)
1159
+ except KeyboardInterrupt:
1160
+ raise typer.Exit(code=130) from None
1161
+
1162
+
976
1163
  __all__ = [
977
1164
  "app",
978
1165
  "discover_cmd",
1166
+ "journal_cmd",
979
1167
  "ping_cmd",
1168
+ "pool_cmd",
980
1169
  "status_cmd",
981
1170
  "sync_cmd",
982
1171
  "tunnel_cmd",
@@ -6,6 +6,8 @@ Notes/Architectural Intent:
6
6
  """
7
7
 
8
8
  import asyncio
9
+ import os
10
+ import subprocess
9
11
 
10
12
  import typer
11
13
  from rich.console import Console
@@ -48,7 +50,9 @@ def list_nodes_cmd(
48
50
 
49
51
  @app.command("ssh")
50
52
  def ssh_node_cmd(
51
- node_id: str = typer.Argument(..., help="Target worker node ID to attach to"),
53
+ node_id: str = typer.Argument(
54
+ ..., help="Target worker node ID or private IP to attach to"
55
+ ),
52
56
  admin: bool = typer.Option(
53
57
  False,
54
58
  "--admin",
@@ -60,17 +64,36 @@ def ssh_node_cmd(
60
64
  "-u",
61
65
  help="Requesting user identity",
62
66
  ),
67
+ direct: bool = typer.Option(
68
+ False,
69
+ "--direct",
70
+ help="Connect directly via SSH jump-host through controller instead of controller API session",
71
+ ),
72
+ jump_host: str | None = typer.Option(
73
+ None,
74
+ "--jump-host",
75
+ help="Jump host public IP/hostname for direct connection",
76
+ ),
77
+ jump_user: str = typer.Option(
78
+ "ubuntu",
79
+ "--jump-user",
80
+ help="Jump host SSH user",
81
+ ),
63
82
  ) -> None:
64
83
  """Open an administrative bastion terminal session on a worker node.
65
84
 
66
85
  Args:
67
- node_id: Target compute node worker ID.
86
+ node_id: Target compute node worker ID or private IP.
68
87
  admin: Explicit administrative elevation confirmation.
69
88
  user: Requesting user identity.
89
+ direct: Whether to connect directly via SSH jump host.
90
+ jump_host: Public IP/hostname of jump host.
91
+ jump_user: Administrative user on jump host.
70
92
 
71
93
  Notes/Architectural Intent:
72
94
  Enforces least privilege: connecting to worker node underlying infrastructure
73
- requires explicit administrative elevation (--admin).
95
+ requires explicit administrative elevation (--admin). Direct mode allows
96
+ out-of-band rescue when the in-band controller API is unreachable.
74
97
  """
75
98
  if not admin:
76
99
  console.print(
@@ -79,6 +102,34 @@ def ssh_node_cmd(
79
102
  )
80
103
  raise typer.Exit(code=1)
81
104
 
105
+ if direct:
106
+ target_jump_host = jump_host or os.environ.get(
107
+ "HEXAQUEUE_CLUSTER_HOST", "129.146.115.79"
108
+ )
109
+ target_jump_user = jump_user or os.environ.get("HEXAQUEUE_ADMIN_USER", "ubuntu")
110
+ target = f"ubuntu@{node_id}"
111
+
112
+ ssh_cmd = [
113
+ "ssh",
114
+ "-A",
115
+ "-t",
116
+ "-o",
117
+ "StrictHostKeyChecking=accept-new",
118
+ "-J",
119
+ f"{target_jump_user}@{target_jump_host}",
120
+ target,
121
+ ]
122
+ console.print(
123
+ f"[dim]Connecting to {target} via jump host {target_jump_user}@{target_jump_host}...[/]"
124
+ )
125
+ try:
126
+ proc = subprocess.run(ssh_cmd, check=False)
127
+ if proc.returncode != 0:
128
+ raise typer.Exit(code=proc.returncode)
129
+ return
130
+ except KeyboardInterrupt:
131
+ raise typer.Exit(code=130) from None
132
+
82
133
  async def _ssh() -> None:
83
134
  client = LocalClientAdapter()
84
135
  try:
File without changes