#How can I export a folder from a service?

1 messages · Page 1 of 1 (latest)

median fjord
#

Hi, I'm using the dagger python SDK to start a jupyter notebooks as a service. I would like to make changes to notebooks and export the notebooks folder after the service ends. Does someone know if this is possible?

#

How can I export a folder from a service?

earnest osprey
#

there's a catch where Dagger won't let you export things from a cache volume directly from a dagger.Directroy you first need to cp them into the container and then export that,

ie:


func (m *MyModule) Export() *dagger.Directory {
  return dag.Container().WithMountedCache("cache", mycache).
  WithExec([]string{"cp", "-r" , "/cache", "/export"}).
  Directory("/export)
}

^ as you can see from the above, I'm copying the /cache content to a different folder which is not a cache volume and exporting that instead.

median fjord
#

Hi @earnest osprey !
Yes, I'm starting the service as you mentioned.
If I understand this correctly, the idea is to add a mounted cache to the jupyter service where the notebooks are. Then use another function to move the contents from the cache to a container directory and export it.
Is this what you meant?