Gralkor.Server (gralkor v1.0.2)

Copy Markdown View Source

Supervises a single Python uvicorn process via Port.

  • init/1 never blocks; handle_continue(:boot) runs the slow work.
  • Boot sequence: write config.yaml → Port.open(uv run uvicorn) → health-poll at 500ms until 200 or 120s timeout → schedule 60s monitor.
  • Health monitor stops the GenServer on failure; supervisor restarts.
  • Graceful shutdown: SIGTERM the OS pid, wait up to 30s for {:exitstatus, }, then SIGKILL.

Summary

Functions

Returns a specification to start this module under a supervisor.

Types

state()

@type state() :: %{
  config: Gralkor.Config.t(),
  port: port() | nil,
  os_pid: non_neg_integer() | nil,
  opts: keyword()
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()