Closed OwenPriceSkelly closed 2 months ago
Attention: Patch coverage is 58.62069%
with 12 lines
in your changes are missing coverage. Please review.
Project coverage is 75.26%. Comparing base (
a9b1f92
) to head (f6ef004
).
Files | Patch % | Lines |
---|---|---|
garden_ai/backend_client.py | 58.62% | 12 Missing :warning: |
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
closes #457
Overview
This gives us a nice way to point certain backend client methods at instances of the revamp-in-progress backend for the sake of testing. This is controlled by the values of a new
GARDEN_BACKEND_TOGGLES
environment variable and the oldGARDEN_ENV
variable.Note that these are left unset by default if you've e.g. installed garden from PyPI. Default behavior for anyone outside of a
poetry shell
is still always to target the current prod backend. Default behavior for anyone inside apoetry shell
(or someone who manually sets these variables) has changed.The new
GARDEN_BACKEND_TOGGLES
variable should be a list of methods to point at revamp resources instead of the usual ones. For example, because I've added a default value ofGARDEN_BACKEND_TOGGLES=mint_doi_on_datacite,update_doi_on_datacite
to the.env.shared
, if you're running garden frompoetry shell
it will default to the dev lambda (as usual) for every method except the two doi methods, which will now target the dev lightsail deployment.The existing
GARDEN_ENV
variable can now be"local"
in addition to "dev" and "prod". If set to dev or prod, the toggled methods will target the respective lightsail deployments instead of the respective dev/prod lambdas. Note that only explicitly setting GARDEN_ENV=prod has this behavior; if GARDEN_ENV is unset then everything is still the old prod resources.If set to "local", toggled methods will target
localhost:5500
to play nicely with the revamp'srun-dev-server.sh
script. un-toggled methods will target the dev lambda when GARDEN_ENV=local.Discussion
The decorator was probably more fun to write than to read. But it works pretty well and will be nice and easy to delete when we're done with the revamp.
Testing
Manually, both by exercising backend methods directly from a repl and by using the CLI in a poetry shell.
Documentation
No docs
📚 Documentation preview 📚: https://garden-ai--458.org.readthedocs.build/en/458/