PrefectHQ / prefect

Prefect is a workflow orchestration framework for building resilient data pipelines in Python.
https://prefect.io
Apache License 2.0
15.33k stars 1.5k forks source link

Add `prefect server status` #6990

Open zanieb opened 1 year ago

zanieb commented 1 year ago

First check

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

jawnsy commented 1 year ago

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

zanieb commented 1 year ago

👍 sounds better to me!

serinamarie commented 2 months ago

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

masonmenges commented 2 months ago

@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.