Skip to content

Add an API and CLI#18

Merged
Garrett Bischof (gwbischof) merged 17 commits into
mainfrom
api-cli
Apr 16, 2026
Merged

Add an API and CLI#18
Garrett Bischof (gwbischof) merged 17 commits into
mainfrom
api-cli

Conversation

@gwbischof

@gwbischof Garrett Bischof (gwbischof) commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

Add an API and CLI for the Holoscan pipeline so that we can monitor and configure it from the workstation.
This also provides an interface to connect a GUI to.
This PR also adds an AGENTS.md so that we can use opencode to help manage the holoscan deployment.

- holoptycho/server/: AppState (state.py), Holoscan runner thread (runner.py),
  FastAPI endpoints /run /stop /status /logs /model (api.py),
  Azure ML + trtexec model swap (model_manager.py)
- holoptycho/cli/main.py: Typer-based hp CLI with start/stop/status/logs/model commands
- pixi.toml: add fastapi, uvicorn, httpx, typer, azure-ai-ml, azure-identity deps;
  add start-api task (localhost:8000)
- pyproject.toml: add hp entry point, register server/cli subpackages
- tests/test_api.py, tests/test_cli.py: 25 tests, all passing (no GPU required)
@gwbischof Garrett Bischof (gwbischof) changed the title Add FastAPI server, hp CLI, and tests Add an API and CLI Apr 16, 2026
- PtychoApp/PtychoSimulApp accept engine_path param (fallback to hardcoded default)
- runner.start() accepts engine_path, resolves: arg > state.current_engine_path > default
- API reads HOLOPTYCHO_ENGINE_PATH env var at startup to pre-populate state
- POST /run accepts optional engine_path in request body
- hp start --engine-path flag for per-run override
- README updated with HOLOPTYCHO_ENGINE_PATH usage
- model folder (ENGINE_CACHE_DIR=/models) is source of truth
- swap_model checks local cache first; only pulls from Azure ML if not cached
- list_models returns combined local engines + Azure ML models with cached flag
- Azure ML gracefully unavailable if env vars not set
- Remove HOLOPTYCHO_ENGINE_PATH and --engine-path (model folder covers this)
- hp model list shows local and Azure sections separately
- README updated with local-first model workflow
Restart stops the running app, waits for the runner thread to exit (up to
30s), then relaunches with the same mode and config. Works from running,
finished, or error states. Returns 400 if no previous run exists.
hp model set now only updates state.current_engine_path (and pulls/compiles
from Azure ML if not cached). The sentinel file mechanism is removed from
model_manager. The new engine is picked up by runner.start() on the next
hp start or hp restart.
@gwbischof
Garrett Bischof (gwbischof) merged commit 2076151 into main Apr 16, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant