MCPcopy Create free account
hub / github.com/dagger/dagger / dagqlServerForModule

Function dagqlServerForModule

core/modtree.go:579–607  ·  view source on GitHub ↗

Initialize a standalone dagql server for querying the given module

(ctx context.Context, mod dagql.ObjectResult[*Module])

Source from the content-addressed store, hash-verified

577
578// Initialize a standalone dagql server for querying the given module
579func dagqlServerForModule(ctx context.Context, mod dagql.ObjectResult[*Module]) (*dagql.Server, error) {
580 main := mod.Self()
581 q, err := CurrentQuery(ctx)
582 if err != nil {
583 return nil, err
584 }
585 srv, err := dagql.NewServer(ctx, q)
586 if err != nil {
587 return nil, fmt.Errorf("create module dagql server: %w", err)
588 }
589 srv.Around(AroundFunc)
590 InstallCoreSchemaLoaders(srv)
591 // Install default "dependencies" (ie the core)
592 defaultDeps, err := q.DefaultDeps(ctx)
593 if err != nil {
594 return nil, fmt.Errorf("%q: load core schema: %w", main.Name(), err)
595 }
596 // Install dependencies
597 for _, defaultDep := range defaultDeps.Mods() {
598 if err := defaultDep.Install(ctx, srv); err != nil {
599 return nil, fmt.Errorf("%q: serve core schema: %w", main.Name(), err)
600 }
601 }
602 // Install the main module
603 if err := NewUserMod(mod).Install(ctx, srv); err != nil {
604 return nil, fmt.Errorf("%q: serve module: %w", main.Name(), err)
605 }
606 return srv, nil
607}
608
609// The address of the dagger module that is the root of the tree
610// If the node is a "file", the root address is the URL of the filesystem root

Callers 2

NewModTreeFunction · 0.85
decodePersistedModTreeFunction · 0.85

Calls 10

AroundMethod · 0.95
NewServerFunction · 0.92
CurrentQueryFunction · 0.85
InstallCoreSchemaLoadersFunction · 0.85
NewUserModFunction · 0.85
SelfMethod · 0.80
ModsMethod · 0.80
DefaultDepsMethod · 0.65
NameMethod · 0.65
InstallMethod · 0.65

Tested by

no test coverage detected