| 787 | } |
| 788 | |
| 789 | func (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 | |
| 816 | func (fn *ModuleFunction) Call(ctx context.Context, opts *CallOpts) (t dagql.AnyResult, rerr error) { |
| 817 | mod := fn.mod.Self() |