#with_mounted_cache not persisting after restarting

1 messages · Page 1 of 1 (latest)

charred elm
#

I'm running my backend database locally for development. When I kill the service (Ctrl+C) and restart it, the with_mounted_cache seems to be lost.

Can I inspect the cache volume? Does the trace help? The docs are sparse: https://docs.dagger.io/manuals/developer/cache-volumes

One of Dagger's most powerful features is its ability to cache data across pipeline runs.

#

with_mounted_cache volumes not persisting after restarting service

#

with_mounted_cache not persisting after restarting service

#

with_mounted_cache not persisting after restarting

vital stump
#

@brisk hound ?

brisk hound
#

If you upgrade to v0.12.1, there may be more logs to help debug this (which can be obtained with docker logs dagger-engine-fec13a4d7c04bf96).

Generally speaking, cache volumes are considered "best-effort" in that they can be pruned if disk space needs to be freed, so something to keep in mind for running database state off of it.

charred elm
#

What should I look for it the 0.12.1 log? There is no mention of the cache volume's name or location.
And what's the alternative to cache volumes for persistence?

brisk hound
# charred elm What should I look for it the 0.12.1 log? There is no mention of the cache volum...

Actually, sorry, I just remembered the PR that showed those logs wasn't merged yet (https://github.com/dagger/dagger/pull/7943), I was getting different PRs confused 😅 Will be in the next release

  • In the meantime, it's harder to say but most likely the engine is pruning the cache volume

We don't have great support for truly persistent state yet. We treat all state as cache and ephemeral right now. However, coming soon is support for storing cache volumes on your host's machine, which will also include making the pruning of it fully manual: https://github.com/dagger/dagger/pull/7646 So then those cache volumes will be persistent until you explicitly tell dagger to delete it, which sounds closer to what you'd want I think?

idle current
#

I think it is exactly what you're looking for, but do tell me if it isn't. Describing your workflow also helps.

charred elm
idle current
#

Oh, looks like this issue has been changed several times. Could you try to describe what exactly you're doing? Showing a minimal example is really appreciated.

charred elm
idle current
charred elm
#

Simply as

dag.container().from_(consts.DB_IMAGE).with_mounted_cache("/tmp/data", dag.cache_volume("db-data")).as_service()
idle current
charred elm
idle current
idle current
#

Restarted my computer as well (fresh session, actually). It appears to work.

#

Something else is involved I believe.

charred elm
idle current
#

I am a bit puzzled by you mentioning ctrl-c. Can you tell us how are you interacting with the Dagger engine? This might reveal something useful.

#

You shouldn't be able to kill the Dagger engine with ctrl-c. It isn't a process/foreground job you have access to directly.

charred elm
idle current
#

As I thought, we were referring to different things. Either way, my setup works both with the dagger engine restarting, as well as the service itself restarting.

#

Is it possible if you could provide more of your dagger setup?

charred elm
#

what would you like to know?