https://garden.io logo
#🌱|help-and-getting-started
Caching Exec Module
# 🌱|help-and-getting-started
o

orange-ability-1812

04/21/2023, 3:39 AM
Wondering if it is possible to cache exec modules? For my stack I first run a build (not a task, so I can run tests on the build) to generate my executables that I copy into my containers. Currently using exec reruns this every time. I understand that for the other modules the caching behavior is baked in and there is no simple way to cache exec calls. Maybe I have to wait for the plugin SDK?
b

bright-policeman-43626

04/21/2023, 7:04 AM
Hey @orange-ability-1812 first of all, welcome to our community! When you say that currently your exec reruns it everytime, you mean that it’s building a new container everytime you execute the task? By any chance have you tried the alpha community release of Garden Bonsai? In this version we introduced a way to do buildless executions, basically what it does is that the tasks/tests are executed in the already running service! Is pretty good. Reference: https://discord.com/channels/817392104711651328/1078632412457734264/1090298050725040248
o

orange-ability-1812

04/22/2023, 1:47 AM
Not a container build. I'm running Pants for Python to build the package and executable. Which is why I'm using the exec module
q

quaint-dress-831

04/24/2023, 2:10 PM
Hi @orange-ability-1812 just curious: what's your larger graph look like? Are you only using Garden for exec modules? Or is the Pants build part of a larger pipeline that leverages other Garden features?
To answer your question: I don't believe we have a method for caching exec calls
o

orange-ability-1812

04/24/2023, 2:45 PM
I ended up figuring out that the setup I described isn't what I need, because ultimately I need a different build that implements hot-reloading of my application. Its a Python server using
uvicorn
which has a
--reload
option. So I can't use my production packaging pipeline for hot-reload anyhow.
To answer the question directly is that I basically had an exec module do the build, then pass that to a container build which I would set up as a server for the dev environment.
q

quaint-dress-831

04/24/2023, 3:22 PM
Yep you'll want to pair this with Dev Mode which I explain in this video using Flask but it should be easily transferable to uvicorn

https://youtu.be/ppv8YomXtNM?t=755

4 Views