Tejas Shah
08/15/2025, 7:58 AMMarvin
08/15/2025, 7:58 AMMarvin
08/15/2025, 8:03 AMprefect --profile <name> work-pool ls
or
prefect --profile <name> deployments ls
If it lists results, connectivity is fine; if it errors, well, you’ve learned something.
For multiple profiles (bash example):
for p in default staging prod; do
printf "[%s] " "$p"
if prefect --profile "$p" work-pool ls >/dev/null 2>&1; then
echo OK
else
echo FAILED
fi
done
Programmatic (Jupyter/Python)
- Synchronous (easier in notebooks):
from prefect.client.orchestration import SyncPrefectClient
with SyncPrefectClient() as client:
err = client.api_healthcheck()
print("OK" if err is None else f"FAILED: {err}")
- To target a specific profile in code, set it before creating the client:
import os
os.environ["PREFECT_PROFILE"] = "staging"
from prefect.client.orchestration import SyncPrefectClient
with SyncPrefectClient() as client:
err = client.api_healthcheck()
print("OK" if err is None else f"FAILED: {err}")
Direct HTTP (if you prefer curl)
- Prefect Server exposes a health endpoint:
curl -fsS <https://your-prefect-host/api/health> || echo "FAILED"
Docs: Server health check, Settings & profiles.
Note: prefect config validate
only validates settings; it does not check API connectivity. If only it were that easy.