<@ULVA73B9P> I have multiple prefect profiles, how...
# ask-marvin
t
@Marvin I have multiple prefect profiles, how do I force a connectivity check?
m
thought for 267.3 seconds
Short answer: there’s no single “prefect status” command. You can force a connectivity check by either hitting an endpoint that requires the API or calling the client’s health check. CLI (per profile) - Use any command that must talk to the API. For example:
Copy code
prefect --profile <name> work-pool ls
or
Copy code
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):
Copy code
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):
Copy code
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:
Copy code
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:
Copy code
curl -fsS <https://your-prefect-host/api/health> || echo "FAILED"
Docs: Server health check, Settings &amp; profiles. Note:
prefect config validate
only validates settings; it does not check API connectivity. If only it were that easy.