#How can I debug why "prepare" is taking so long (~30s)?

1 messages · Page 1 of 1 (latest)

bronze breach
#

When I execute a function with dagger call I see that prepare takes around half a minute.

✔ prepare 34.2s

I've updated my dagger.json as follows but the problem persists:

  "exclude": [
    "**/node_modules"
  ]

Is there a good way to debug this?

sonic hill
#

I think dagger.json supports an exclude setting. Let me check.

bronze breach
#

Yeah I've tried it but it doesn't seem to help.

Under prepare I see ModuleSoruce@[...].resolveDirectoryFromCaller(path: "."): Directory! = [...] taking a long time!

sonic hill
#

Does your call involve some sort of Directory?

bronze breach
#

Hmmm just passing --source="."

sonic hill
#

Okay, cool.

#

There exists a workaround solution for that using what's called views. That workaround solution will be depreciated and ceased soon when the upcoming solution is merged. For now, you can use that.

#

I will link the explanation here.

bronze breach
#

Oh I'll look it up, thank you!

sonic hill
#

Alright. You can use it with --source=.:default

bronze breach
#

👀

sonic hill
#

You should use only includes if you want the most performant solution. It is generally easier to do any way.

#
{
    "name": "m",
    "sdk": "go",
    "source": "dagger",
    "engineVersion": "v0.11.6",
    "views": [
        {
            "name": "view",
            "patterns": [
                "Cargo.toml",
                "Cargo.lock",
                "src/**/*.rs",
                "migrations/*.sql"
            ]
        }
    ]
}
#

This is an old configuration of mine that I was using to test the Go sdk.

#

You see it doesn't have any ! marks. That means it is include-by-default.

#

(Which acts like a whitelist/allowlist)

bronze breach
#

Useful, I'll give it a try!

sonic hill
#

For a Rust project, it is generally all you need.

#

But your project layout is probably different because of go. In that case, having something like **/*.go will work, along with go.mod and such.

bronze breach
sonic hill
#

Yup. That uses allow-by-default. I like the deny-by-default approach.

bronze breach
#

Works like a charm, took 4s this time! Thank you.

#

(it was killing me!!!!)

sonic hill
#

Had the same exact feeling when I discovered it :)

#

Happy hacking ^^

latent boltBOT