prefect icon indicating copy to clipboard operation
prefect copied to clipboard

Add `prefect server status`

Open zanieb opened this issue 3 years ago • 4 comments

First check

  • [X] I added a descriptive title to this issue.
  • [X] I used the GitHub search to find a similar request and didn't find it.
  • [X] I searched the Prefect documentation for this feature.

Prefect Version

2.x

Describe the current behavior

To perform a healthcheck, manual API requests must be made.

Describe the proposed behavior

We should provide a CLI command to perform healthchecks against the configured server: prefect server status

This command should return a 0 or 1 status code depending on the availability of the server. It can also display information about the server if it is available.

This command should include a --wait flag that will attempt to connect until the service responds with a healthy value.

This command should include a --timeout <seconds> option that will fail the healthcheck after a total number of seconds.

Example Use

This is especially useful in combination with --detach as proposed in #6989

prefect orion start --detach
prefect orion status --wait --timeout 60

Possible output

$ prefect orion status
Connecting to <address>...
Server available.
...

Also useful when run in a Docker container

Additional context

This would replace the script at https://github.com/PrefectHQ/prefect/blob/main/scripts/wait-for-server.py

zanieb avatar Sep 27 '22 17:09 zanieb

I'd propose a prefect orion status command instead, which would print information about the running instance, but also allow people to suppress output (in case they only care about the status code, such as for readinessProbe checks).

This is how Vault handles their readiness probes: https://github.com/hashicorp/vault-helm/blob/7e21a09ebd9fb7890c5dfe90c4716b50d1662637/templates/server-statefulset.yaml#L160-L161

jawnsy avatar Oct 01 '22 19:10 jawnsy

👍 sounds better to me!

zanieb avatar Oct 02 '22 15:10 zanieb

Hi @masonmenges, looks like this was assigned to you awhile ago. Shall I unassign?

serinamarie avatar Apr 30 '24 21:04 serinamarie

@serinamarie That should be fine, if time permits I might take a look at this again but I haven't looked at this in a while.

masonmenges avatar Apr 30 '24 21:04 masonmenges