executor.go ×7

Frontier kind: Code frontier

unlabeled · c_5085fe73ed4b

8 tests · 1261 LOC · 57 files · introduces 0 tests · 38 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
9 ranges38 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
117 ranges1261 lines · 57 files · Browse complete extent
All tests (intent)
8 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Introduced files, introduced tests, and structurally relevant concept specializationworkflow.go ×2 · 7 introduced LOCworkflow.go ×2db.go ×2 · 9 introduced LOCdb.go ×2handler.go ×5 · 28 introduced LOChandler.go ×5TestExpiredTasksFollowedByAlive · 0 introduced LOCTestExpiredTasksFollowed…handler.go ×3 · 26 introduced LOChandler.go ×3handler.go ×1 · 2 introduced LOChandler.go ×1handler.go ×6 · 82 introduced LOChandler.go ×6scavenger.go ×1 · 3 introduced LOCscavenger.go ×1scavenger.go ×12 · 86 introduced LOCscavenger.go ×12runq.go ×2 · 3 introduced LOCrunq.go ×2runq.go ×6 · 25 introduced LOCrunq.go ×6executor.go ×3 · 19 introduced LOCexecutor.go ×3runq.go ×6 · 21 introduced LOCrunq.go ×6TestStartStop · 0 introduced LOCTestStartStopservice.pb.go ×2 · 342 introduced LOCservice.pb.go ×2message.pb.go ×2 · 20 introduced LOCmessage.pb.go ×2message.pb.go ×2 · 442 introduced LOCmessage.pb.go ×2tags.go ×1 · 3 introduced LOCtags.go ×1defs.go ×5 · 91 introduced LOCdefs.go ×5tags.go ×9 · 37 introduced LOCtags.go ×9message.pb.go ×2 · 49 introduced LOCmessage.pb.go ×2cluster.pb.go ×2 · 200 introduced LOCcluster.pb.go ×2retrypolicy.go ×3 · 19 introduced LOCretrypolicy.go ×3message.pb.go ×2 · 20 introduced LOCmessage.pb.go ×2TestOperatorServiceMetadata, TestWorkflowServiceMetadata · 0 introduced LOCTestOperatorServiceMetad…go.temporal.io/server/api/adminservice/v1/request_response.pb.go · 6661 LOCv1/request_response.pb.g…go.temporal.io/server/api/adminservice/v1/service.pb.go · 297 LOCv1/service.pb.gogo.temporal.io/server/api/clock/v1/message.pb.go · 217 LOCv1/message.pb.gogo.temporal.io/server/api/cluster/v1/message.pb.go · 366 LOCv1/message.pb.gogo.temporal.io/server/api/common/v1/api_category.pb.go · 230 LOCv1/api_category.pb.gogo.temporal.io/server/api/common/v1/dlq.pb.go · 319 LOCv1/dlq.pb.gogo.temporal.io/server/api/deployment/v1/message.pb.go · 4650 LOCv1/message.pb.gogo.temporal.io/server/api/enums/v1/cluster.pb.go · 233 LOCv1/cluster.pb.gogo.temporal.io/server/api/enums/v1/common.pb.go · 288 LOCv1/common.pb.gogo.temporal.io/server/api/enums/v1/dlq.pb.go · 211 LOCv1/dlq.pb.gogo.temporal.io/server/api/enums/v1/fairness_state.pb.go · 147 LOCv1/fairness_state.pb.gogo.temporal.io/server/api/enums/v1/nexus.pb.go · 182 LOCv1/nexus.pb.gogo.temporal.io/server/api/enums/v1/predicate.pb.go · 194 LOCv1/predicate.pb.gogo.temporal.io/server/api/enums/v1/replication.pb.go · 338 LOCv1/replication.pb.gogo.temporal.io/server/api/enums/v1/task.pb.go · 480 LOCv1/task.pb.gogo.temporal.io/server/api/enums/v1/workflow.pb.go · 299 LOCv1/workflow.pb.gogo.temporal.io/server/api/enums/v1/workflow_task_type.pb.go · 148 LOCv1/workflow_task_type.pb…go.temporal.io/server/api/errordetails/v1/message.pb.go · 649 LOCv1/message.pb.gogo.temporal.io/server/api/health/v1/message.pb.go · 324 LOCv1/message.pb.gogo.temporal.io/server/api/history/v1/message.pb.go · 522 LOCv1/message.pb.gogo.temporal.io/server/api/historyservice/v1/request_response.pb.go · 12003 LOCv1/request_response.pb.g…go.temporal.io/server/api/historyservice/v1/service.pb.go · 452 LOCv1/service.pb.gogo.temporal.io/server/api/matchingservice/v1/request_response.pb.go · 6878 LOCv1/request_response.pb.g…go.temporal.io/server/api/matchingservice/v1/service.pb.go · 274 LOCv1/service.pb.gogo.temporal.io/server/api/metrics/v1/message.pb.go · 128 LOCv1/message.pb.gogo.temporal.io/server/api/namespace/v1/message.pb.go · 138 LOCv1/message.pb.gogo.temporal.io/server/api/persistence/v1/chasm.pb.go · 1215 LOCv1/chasm.pb.gogo.temporal.io/server/api/persistence/v1/chasm_visibility.pb.go · 170 LOCv1/chasm_visibility.pb.g…go.temporal.io/server/api/persistence/v1/cluster_metadata.pb.go · 313 LOCv1/cluster_metadata.pb.g…go.temporal.io/server/api/persistence/v1/executions.pb.go · 5768 LOCv1/executions.pb.gogo.temporal.io/server/api/persistence/v1/history_tree.pb.go · 298 LOCv1/history_tree.pb.gogo.temporal.io/server/api/persistence/v1/hsm.pb.go · 929 LOCv1/hsm.pb.gogo.temporal.io/server/api/persistence/v1/namespaces.pb.go · 560 LOCv1/namespaces.pb.gogo.temporal.io/server/api/persistence/v1/nexus.pb.go · 509 LOCv1/nexus.pb.gogo.temporal.io/server/api/persistence/v1/predicates.pb.go · 864 LOCv1/predicates.pb.gogo.temporal.io/server/api/persistence/v1/queue_metadata.pb.go · 129 LOCv1/queue_metadata.pb.gogo.temporal.io/server/api/persistence/v1/queues.pb.go · 641 LOCv1/queues.pb.gogo.temporal.io/server/api/persistence/v1/task_queues.pb.go · 924 LOCv1/task_queues.pb.gogo.temporal.io/server/api/persistence/v1/tasks.pb.go · 870 LOCv1/tasks.pb.gogo.temporal.io/server/api/persistence/v1/update.pb.go · 455 LOCv1/update.pb.gogo.temporal.io/server/api/persistence/v1/workflow_mutable_state.pb.go · 560 LOCv1/workflow_mutable_stat…go.temporal.io/server/api/replication/v1/message.pb.go · 2481 LOCv1/message.pb.gogo.temporal.io/server/api/taskqueue/v1/message.pb.go · 1363 LOCv1/message.pb.gogo.temporal.io/server/api/token/v1/message.pb.go · 809 LOCv1/message.pb.gogo.temporal.io/server/api/workflow/v1/message.pb.go · 302 LOCv1/message.pb.gogo.temporal.io/server/common/backoff/retrypolicy.go · 347 LOCbackoff/retrypolicy.gogo.temporal.io/server/common/build/build.go · 56 LOCbuild/build.gogo.temporal.io/server/common/log/tag/tags.go · 1039 LOCtag/tags.gogo.temporal.io/server/common/log/tag/zap_tag.go · 242 LOCtag/zap_tag.gogo.temporal.io/server/common/metrics/defs.go · 76 LOCmetrics/defs.gogo.temporal.io/server/common/metrics/defs_base.go · 30 LOCmetrics/defs_base.gogo.temporal.io/server/common/metrics/noop_impl.go · 58 LOCmetrics/noop_impl.gogo.temporal.io/server/common/metrics/option.go · 21 LOCmetrics/option.gogo.temporal.io/server/common/metrics/registry.go · 75 LOCmetrics/registry.gogo.temporal.io/server/common/metrics/tags.go · 619 LOCmetrics/tags.gogo.temporal.io/server/common/persistence/data_interfaces_mock.go · 1462 LOCpersistence/data_interfa…go.temporal.io/server/service/worker/scanner/executor/executor.go · 144 LOCexecutor/executor.gogo.temporal.io/server/service/worker/scanner/executor/runq.go · 105 LOCexecutor/runq.gogo.temporal.io/server/service/worker/scanner/taskqueue/db.go · 105 LOCtaskqueue/db.gogo.temporal.io/server/service/worker/scanner/taskqueue/handler.go · 117 LOCtaskqueue/handler.gogo.temporal.io/server/service/worker/scanner/taskqueue/scavenger.go · 211 LOCtaskqueue/scavenger.gogo.temporal.io/server/service/worker/scanner/workflow.go · 194 LOCscanner/workflow.goTestOperatorServiceMetadata · introduced test · go.temporal.io/server/common/api/TestOperatorServiceMetadataTestOperatorServiceMetad…TestWorkflowServiceMetadata · introduced test · go.temporal.io/server/common/api/TestWorkflowServiceMetadataTestWorkflowServiceMetad…TestMutexMapBaggage · introduced test · go.temporal.io/server/common/metrics/TestBaggageBenchSuite/TestMutexMapBaggageTestMutexMapBaggageTestSyncMapBaggage · introduced test · go.temporal.io/server/common/metrics/TestBaggageBenchSuite/TestSyncMapBaggageTestSyncMapBaggageTestScavengerActivity · introduced test · go.temporal.io/server/service/worker/scanner/TestScannerWorkflowTestSuite/TestScavengerActivityTestScavengerActivityTestStartStop · introduced test · go.temporal.io/server/service/worker/scanner/executor/TestExecutionTestSuite/TestStartStopTestStartStopTestTaskExecution · introduced test · go.temporal.io/server/service/worker/scanner/executor/TestExecutionTestSuite/TestTaskExecutionTestTaskExecutionTestAliveTasksFollowedByExpired · introduced test · go.temporal.io/server/service/worker/scanner/taskqueue/TestScavengerTestSuite/TestAliveTasksFollowedByExpiredTestAliveTasksFollowedBy…TestAllAliveTasks · introduced test · go.temporal.io/server/service/worker/scanner/taskqueue/TestScavengerTestSuite/TestAllAliveTasksTestAllAliveTasksTestAllExpiredTasks · introduced test · go.temporal.io/server/service/worker/scanner/taskqueue/TestScavengerTestSuite/TestAllExpiredTasksTestAllExpiredTasksTestAllExpiredTasksWithErrors · introduced test · go.temporal.io/server/service/worker/scanner/taskqueue/TestScavengerTestSuite/TestAllExpiredTasksWithErrorsTestAllExpiredTasksWithE…TestExpiredTasksFollowedByAlive · introduced test · go.temporal.io/server/service/worker/scanner/taskqueue/TestScavengerTestSuite/TestExpiredTasksFollowedByAliveTestExpiredTasksFollowed…Focused concept · executor.go ×7 · 38 introduced LOCexecutor.go ×7

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 38 introduced LOC across 9 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/worker/scanner/executor/executor.go 26 introduced LOC · 7 ranges

Open complete file

62 // from your task.Run method. When a task is deferred, it will be added to the tail of a
63 // deferredTaskQ which in turn will be processed after the current runQ is drained
64 > func NewFixedSizePoolExecutor(size int, maxDeferred int, metricsHandler metrics.Handler, operation string) Executor { executor.go
65 > stopC := make(chan struct{})
66 > return &fixedPoolExecutor{
67 > size: size,
68 > maxDeferred: maxDeferred,
69 > runQ: newRunQueue(size, stopC),
70 > metricsHandler: metricsHandler.WithTags(metrics.OperationTag(operation)),
71 > stopC: stopC,
72 > }
73 > }
74
75 // Start starts the executor
76 > func (e *fixedPoolExecutor) Start() { executor.go
77 > if !atomic.CompareAndSwapInt32(&e.status, common.DaemonStatusInitialized, common.DaemonStatusStarted) {
78 return
79 }
80 > for i := 0; i < e.size; i++ { executor.go
81 > e.stopWG.Add(1)
82 > go e.worker()
83 > }
84 }
85
86 // Stop stops the executor
87 > func (e *fixedPoolExecutor) Stop() { executor.go
88 > if !atomic.CompareAndSwapInt32(&e.status, common.DaemonStatusStarted, common.DaemonStatusStopped) {
89 return
90 }
91 > close(e.stopC) executor.go
92 > e.stopWG.Wait()
93 }
94
110 }
111
112 > func (e *fixedPoolExecutor) worker() { executor.go
113 > defer e.stopWG.Done()
114 > for e.alive() {
115 task, ok := e.runQ.remove()
116 if !ok {
140 }
141
142 > func (e *fixedPoolExecutor) alive() bool { executor.go
143 > return atomic.LoadInt32(&e.status) == common.DaemonStatusStarted
144 > }
go.temporal.io/server/service/worker/scanner/executor/runq.go 12 introduced LOC · 2 ranges

Open complete file

22
23 // newRunQueue returns an instance of task run queue
24 > func newRunQueue(size int, stopC chan struct{}) *runQueue { runq.go
25 > return &runQueue{
26 > tasks: make(chan Task, size),
27 > deferredTasks: newThreadSafeList(),
28 > stopC: stopC,
29 > }
30 > }
31
32 func (rq *runQueue) add(task Task) bool {
77
78 // newThreadSafeList returns a new thread safe linked list
79 > func newThreadSafeList() *threadSafeList { runq.go
80 > return &threadSafeList{
81 > list: list.New(),
82 > }
83 > }
84
85 func (tl *threadSafeList) add(elem any) {