workflow.go ×7

Frontier kind: Code frontier

unlabeled · c_2fd6ffaa2125

2 tests · 2574 LOC · 130 files · introduces 0 tests · 64 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges64 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
387 ranges2574 lines · 130 files · Browse complete extent
All tests (intent)
2 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.

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: 64 introduced LOC across 8 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/worker/parentclosepolicy/workflow.go 58 introduced LOC · 7 ranges

Open complete file

86
87 // ProcessorActivity is activity for processing batch operation
88 > func ProcessorActivity(ctx context.Context, request Request) error { workflow.go
89 > processor := ctx.Value(processorContextKey).(*Processor)
90 > client := processor.clientBean.GetHistoryClient()
91 > // this is for backward compatibility
92 > // ideally we should always have childWorkflowOnly = true
93 > // however if ParentExecution is not specified, setting it to false
94 > // will cause terminate or cancel request to return mismatch error
95 > childWorkflowOnly := request.ParentExecution.GetWorkflowId() != "" &&
96 > request.ParentExecution.GetRunId() != ""
97 >
98 > remoteExecutions := make(map[string][]RequestDetail)
99 > for _, execution := range request.Executions {
100 > requestCtx := headers.SetCallerName(ctx, execution.Namespace)
101 >
102 > var err error
103 > switch execution.Policy {
104 case enumspb.PARENT_CLOSE_POLICY_ABANDON:
105 // no-op
106 continue
107 > case enumspb.PARENT_CLOSE_POLICY_TERMINATE: workflow.go
108 > _, err = client.TerminateWorkflowExecution(requestCtx, &historyservice.TerminateWorkflowExecutionRequest{
109 > NamespaceId: execution.NamespaceID,
110 > TerminateRequest: &workflowservice.TerminateWorkflowExecutionRequest{
111 > Namespace: execution.Namespace,
112 > WorkflowExecution: &commonpb.WorkflowExecution{
113 > WorkflowId: execution.WorkflowID,
114 > },
115 > Reason: "by parent close policy",
116 > Identity: processorWFTypeName,
117 > FirstExecutionRunId: execution.RunID,
118 > },
119 > ExternalWorkflowExecution: request.ParentExecution,
120 > ChildWorkflowOnly: childWorkflowOnly,
121 > })
122 > case enumspb.PARENT_CLOSE_POLICY_REQUEST_CANCEL:
123 > _, err = client.RequestCancelWorkflowExecution(requestCtx, &historyservice.RequestCancelWorkflowExecutionRequest{
124 > NamespaceId: execution.NamespaceID,
125 > CancelRequest: &workflowservice.RequestCancelWorkflowExecutionRequest{
126 > Namespace: execution.Namespace,
127 > WorkflowExecution: &commonpb.WorkflowExecution{
128 > WorkflowId: execution.WorkflowID,
129 > },
130 > Identity: processorWFTypeName,
131 > FirstExecutionRunId: execution.RunID,
132 > },
133 > ExternalWorkflowExecution: request.ParentExecution,
134 > ChildWorkflowOnly: childWorkflowOnly,
135 > })
136 }
137
138 > switch typedErr := err.(type) { workflow.go
139 case nil:
140 metrics.ParentClosePolicyProcessorSuccess.With(processor.metricsHandler).Record(1)
150 }
151
152 > if err := signalRemoteCluster( workflow.go
153 > ctx,
154 > processor.currentCluster,
155 > processor.clientBean,
156 > request.ParentExecution,
157 > remoteExecutions,
158 > processor.cfg.NumParentClosePolicySystemWorkflows(),
159 > ); err != nil {
160 getActivityLogger(ctx).Error("Failed to signal remote parent close policy workflow", tag.Error(err))
161 return err
162 }
163
164 > return nil workflow.go
165 }
166
172 remoteExecutions map[string][]RequestDetail,
173 numWorkflows int,
174 > ) error { workflow.go
175 > for cluster, executions := range remoteExecutions {
176 _, remoteClient, err := clientBean.GetRemoteFrontendClient(cluster)
177 if err != nil {
go.temporal.io/server/client/client_bean_mock.go 6 introduced LOC · 1 range

Open complete file

72
73 // GetHistoryClient mocks base method.
74 > func (m *MockBean) GetHistoryClient() historyservice.HistoryServiceClient { client_bean_mock.go
75 > m.ctrl.T.Helper()
76 > ret := m.ctrl.Call(m, "GetHistoryClient")
77 > ret0, _ := ret[0].(historyservice.HistoryServiceClient)
78 > return ret0
79 > }
80
81 // GetHistoryClient indicates an expected call of GetHistoryClient.