MCPcopy Index your code
hub / github.com/dagger/dagger / loadFunctionRuntime

Method loadFunctionRuntime

core/modfunc.go:789–814  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

787}
788
789func (fn *ModuleFunction) loadFunctionRuntime(ctx context.Context) (_ ModuleRuntime, rerr error) {
790 // hide all this internal plumbing making up the call
791 ctx, hideSpan := Tracer(ctx).Start(ctx, "load sdk runtime", telemetry.Internal())
792 defer telemetry.EndWithCause(hideSpan, &rerr)
793
794 mod := fn.mod.Self()
795 if mod.Runtime.Valid {
796 return &ContainerRuntime{Container: mod.Runtime.Value}, nil
797 }
798
799 if !mod.Source.Valid {
800 return nil, fmt.Errorf("no source")
801 }
802
803 runtimeImpl, ok := mod.Source.Value.Self().SDKImpl.AsRuntime()
804 if !ok {
805 return nil, fmt.Errorf("no runtime implemented")
806 }
807
808 runtime, err := runtimeImpl.Runtime(ctx, mod.Deps, mod.Source.Value)
809 if err != nil {
810 return nil, fmt.Errorf("failed to load runtime: %w", err)
811 }
812
813 return runtime, nil
814}
815
816func (fn *ModuleFunction) Call(ctx context.Context, opts *CallOpts) (t dagql.AnyResult, rerr error) {
817 mod := fn.mod.Self()

Callers 1

CallMethod · 0.95

Calls 6

InternalMethod · 0.80
SelfMethod · 0.80
TracerFunction · 0.70
StartMethod · 0.65
AsRuntimeMethod · 0.65
RuntimeMethod · 0.65

Tested by

no test coverage detected