MCPcopy Index your code
hub / github.com/FunctionStream/function-stream / Run

Method Run

perf/perf.go:81–220  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

79}
80
81func (p *perf) Run(ctx context.Context) {
82 slog.Info(
83 "Starting Function stream perf client",
84 slog.Any("config", p.config),
85 )
86
87 name := "perf-" + strconv.Itoa(rand.Int())
88 var f adminclient.ModelFunction
89 if p.config.Func != nil {
90 f = *p.config.Func
91 } else {
92 f = adminclient.ModelFunction{
93 Runtime: adminclient.ModelRuntimeConfig{
94 Config: map[string]interface{}{
95 common.RuntimeArchiveConfigKey: "./bin/example_basic.wasm",
96 },
97 },
98 Source: utils.MakeMemorySourceTubeConfig("test-input-" + strconv.Itoa(rand.Int())),
99 Sink: *utils.MakeMemorySinkTubeConfig("test-output-" + strconv.Itoa(rand.Int())),
100 }
101 }
102 f.Name = name
103
104 queueFactory, err := p.tubeBuilder(ctx)
105 if err != nil {
106 slog.Error(
107 "Failed to create Record Queue Factory",
108 slog.Any("error", err),
109 )
110 os.Exit(1)
111 }
112
113 inputTopic, err := utils.GetInputTopics(&f)
114 if err != nil {
115 slog.Error(
116 "Failed to get input topics",
117 slog.Any("error", err),
118 )
119 os.Exit(1)
120
121 }
122 p.input, err = queueFactory.NewSinkTube(ctx, (&contube.SinkQueueConfig{
123 Topic: inputTopic[0],
124 }).ToConfigMap())
125 if err != nil {
126 slog.Error(
127 "Failed to create Sink Perf Channel",
128 slog.Any("error", err),
129 )
130 os.Exit(1)
131 }
132
133 outputTopic, err := utils.GetOutputTopic(&f)
134 if err != nil {
135 slog.Error(
136 "Failed to get output topic",
137 slog.Any("error", err),
138 )

Callers

nothing calls this directly

Calls 15

generateTrafficMethod · 0.95
MakeMemorySinkTubeConfigFunction · 0.92
GetInputTopicsFunction · 0.92
GetOutputTopicFunction · 0.92
ErrorMethod · 0.80
CreateFunctionMethod · 0.80
NewSinkTubeMethod · 0.65
NewSourceTubeMethod · 0.65
DeleteFunctionMethod · 0.65
StopMethod · 0.65
ToConfigMapMethod · 0.45

Tested by

no test coverage detected