feat: speed up loading of output data from Terraform state
Description
This speeds up the loading of Terraform outputs (which happens in Instance.tutor_env()
). Currently it makes sequential calls to tf output VAR
, but each call has some overhead for loading the state. If we instead make a single call to tf output
and cache it, we can then access each output in less time.
Using my clipboard_preview instance, before this change tutor_env took ~41s, now it takes ~14s. This is a big improvement in quality of life if you are running lots of grove commands or trying something over and over.
Supporting information
n/a
Testing instructions
Put this into cli.py
@tutor_app.command()
def testenv(instance_name: str):
"""
Temporary command to get the tutor env
"""
instance = Instance(instance_name)
print(instance.tutor_env())
Then run time ./grove tutor testenv SOME_INSTANCE
before and after this change.
Dependencies
None
Screenshots
None
Checklist
If any of the items below is not applicable, do not remove them, but put a check in it.
-
All providers include the new feature/change -
All affected providers can provision new clusters -
Unit tests are added/updated -
Documentation is added/updated -
The TOOLS_CONTAINER_IMAGE_VERSION
in ci_vars.yml is updated -
The grove-template repository is updated
Additional context
Ticket: MNG-3815