#ModuleSource.resolveDirectoryFromCaller takes forever

1 messages Ā· Page 1 of 1 (latest)

restive mango
#

I'm trying to use dagger from an existing repo but the initialize step takes a very long time

ModuleSource.resolveDirectoryFromCaller(path: "."): Directory! 48.9s
ā— upload /Users/myrepo from mbp-de-admin.home (client id: fo4rf9tcaqu5fwaug2apatwhc) 48.9s

it is like dagger was trying to upload everything into docker context
I've tried to exlude folder using dagger.json but it didn't worked
Any clues?

crisp cypress
#

Hey @restive mango! I have a few questions:

  • Which dagger version are you using?
  • What are the changes that you made to dagger.json?
  • What path is the module in relation to the repo root?
  • You show the upload span, but without the exclude and include that usually are a part of that span. Can you share it? Do you notice anything out of place in those patterns?

Here's one tip to help debug further šŸ™‚

Create a function that uses your language's stdlib to list files in /src (or run command find /src). When a module is loaded, files are uploaded from the entire repo that match the patterns, and mounted under /src. So you can get confirmation on what actually was uploaded or not.

Here's an example in Python:

    @function
    async def tree(
        self,
        path: Annotated[str, Doc("The directory path in the runtime container")] = "/src",
        pattern: Annotated[str, Doc("Glob pattern for matching files")] = "**/*",
    ) -> list[str]:
        """List the files in a directory."""
        return [str(p) async for p in anyio.Path(path).glob(pattern)]
restive mango
#
  • I'm using dagger v0.11.4

  • dagger.json changes

+  "exclude": [
+    "**/venv/**",
+    "**/.git/**"
+  ], 

The function call below is working

dagger -m github.com/shykes/daggerverse/hello@v0.1.2 call hello

Daggerize a project

Write your first function

crisp cypress
#
  • The **/.git pattern is not necessary as it's the default.
  • Do you have venv instead of .venv?
  • Is there another line below that one? What if you add -v to dagger -v -m ... call ...?
#

The upload span only shows for local directories btw, not modules loaded by git URL.

#

Look for the resolveFromCaller function. You mentioned resolveDirectoryFromCaller but I think that's for a directory argument, not loading the module. Might as well clarify which one you're trying to solve. Is the issue in loading the module or in a Directory argument?

#

Should show something like this:

āœ” ModuleSource.resolveFromCaller: ModuleSource! 0.6s
  āœ” upload /Users/myrepo from mbp-de-admin.home (client id: zilurkdih0uslswe8u5581rhf) (exclude: **/.git) (include: **/go.work, **/go.work.sum, **/vendor/, **/*.go, dagger.json, ci/**/*, **/go.mod, **/go.sum) 0.6s
restive mango
#

ok, lemme try you first solution

restive mango
#

I've tried the tree function you provided and the list is quite small to be honest

Context, I'm running the function from the guide that build a container

dagger call -v  build-and-publish \
  --build-src=. \
  --build-args="-C","./hello"
crisp cypress
#

Ok, are you following the guide as is or adding modifications?

restive mango
#

following the guide