-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathworkflow_on_many_task_queues.go
More file actions
41 lines (38 loc) · 1.37 KB
/
workflow_on_many_task_queues.go
File metadata and controls
41 lines (38 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package scenarios
import (
"context"
"fmt"
"github.com/temporalio/omes/loadgen"
"github.com/temporalio/omes/loadgen/kitchensink"
)
func init() {
loadgen.MustRegisterScenario(loadgen.Scenario{
Description: "Each iteration executes a single workflow on one of the task queues. " +
"Workers must be started with --task-queue-suffix-index-end as one less than task queue count here. " +
"Additional options: task-queue-count (required).",
ExecutorFn: func() loadgen.Executor {
return loadgen.KitchenSinkExecutor{
TestInput: &kitchensink.TestInput{
WorkflowInput: &kitchensink.WorkflowInput{
InitialActions: []*kitchensink.ActionSet{
kitchensink.NoOpSingleActivityActionSet(),
},
},
},
PrepareTestInput: func(ctx context.Context, opts loadgen.ScenarioInfo, params *kitchensink.TestInput) error {
// Require task queue count
if opts.ScenarioOptionInt("task-queue-count", 0) == 0 {
return fmt.Errorf("task-queue-count option required")
}
return nil
},
UpdateWorkflowOptions: func(ctx context.Context, run *loadgen.Run, options *loadgen.KitchenSinkWorkflowOptions) error {
// Add suffix to the task queue based on modulus of iteration
options.StartOptions.TaskQueue +=
fmt.Sprintf("-%v", run.Iteration%run.ScenarioInfo.ScenarioOptionInt("task-queue-count", 0))
return nil
},
}
},
})
}