MCPcopy Create free account
hub / github.com/ShipSecAI/studio / runTemporalBenchmark

Function runTemporalBenchmark

worker/scripts/benchmark-scheduler.ts:158–196  ·  view source on GitHub ↗
(
  client: Client,
  definition: WorkflowDefinition,
  iterations: number,
  label: BenchmarkMode,
)

Source from the content-addressed store, hash-verified

156};
157
158async function runTemporalBenchmark(
159 client: Client,
160 definition: WorkflowDefinition,
161 iterations: number,
162 label: BenchmarkMode,
163): Promise<BenchmarkResult> {
164 const durations: number[] = [];
165
166 for (let i = 0; i < iterations; i += 1) {
167 const runId = `${label}-${randomUUID()}`;
168 const start = Date.now();
169
170 const handle = await client.workflow.start(shipsecWorkflowRun, {
171 workflowId: runId,
172 taskQueue: TEMPORAL_TASK_QUEUE,
173 args: [
174 {
175 runId,
176 workflowId: `benchmark-${label}`,
177 definition,
178 inputs: {},
179 },
180 ],
181 });
182
183 await handle.result();
184 durations.push(Date.now() - start);
185 }
186
187 const averageMs = durations.reduce((sum, value) => sum + value, 0) / durations.length;
188
189 return {
190 engine: 'temporal',
191 mode: label,
192 runs: iterations,
193 durations,
194 averageMs,
195 };
196}
197
198async function ensureOutputDir() {
199 await fs.mkdir(OUTPUT_DIR, { recursive: true });

Callers 1

mainFunction · 0.85

Calls 2

resultMethod · 0.80
pushMethod · 0.65

Tested by

no test coverage detected