invoker_tasks.go ×8

Frontier kind: Joint frontier

unlabeled · c_962a230c0275

2 tests · 5729 LOC · 177 files · introduces 1 test · 56 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
12 ranges56 lines · 2 files
Tests
1 test

Contains — complete concept membership

All code (extent)
1314 ranges5729 lines · 177 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.

1 test introduced at this concept.

Introduced code

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

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

go.temporal.io/server/chasm/lib/scheduler/invoker_tasks.go 48 introduced LOC · 8 ranges

Open complete file

276
277 for _, wf := range targets {
278 > if !ctx.takeNextAction() { invoker_tasks.go
279 break
280 }
281
282 // Run all cancels concurrently.
283 > newCtx := ctx.Clone() invoker_tasks.go
284 > wg.Go(func() {
285 > err := h.cancelWorkflow(newCtx, scheduler, wf)
286 >
287 > resultMutex.Lock()
288 > defer resultMutex.Unlock()
289 >
290 > if err != nil {
291 logger.Info("failed to cancel workflow", tag.Error(err), tag.WorkflowID(wf.WorkflowId))
292 metricsHandler.Counter(metrics.ScheduleCancelWorkflowErrors.Name()).Record(1)
294
295 // Cancels are only attempted once.
296 > result.CompletedCancels = append(result.CompletedCancels, wf) invoker_tasks.go
297 })
298 }
314
315 for _, wf := range targets {
316 > if !ctx.takeNextAction() { invoker_tasks.go
317 break
318 }
319
320 // Run all terminates concurrently.
321 > newCtx := ctx.Clone() invoker_tasks.go
322 > wg.Go(func() {
323 > err := h.terminateWorkflow(newCtx, scheduler, wf)
324 >
325 > resultMutex.Lock()
326 > defer resultMutex.Unlock()
327 >
328 > if err != nil {
329 logger.Info("failed to terminate workflow", tag.Error(err), tag.WorkflowID(wf.WorkflowId))
330 metricsHandler.Counter(metrics.ScheduleTerminateWorkflowErrors.Name()).Record(1)
332
333 // Terminates are only attempted once.
334 > result.CompletedTerminates = append(result.CompletedTerminates, wf) invoker_tasks.go
335 })
336 }
711 scheduler *Scheduler,
712 target *commonpb.WorkflowExecution,
713 > ) error { invoker_tasks.go
714 > request := &historyservice.TerminateWorkflowExecutionRequest{
715 > NamespaceId: scheduler.NamespaceId,
716 > TerminateRequest: &workflowservice.TerminateWorkflowExecutionRequest{
717 > Namespace: scheduler.Namespace,
718 > WorkflowExecution: &commonpb.WorkflowExecution{WorkflowId: target.WorkflowId},
719 > Reason: "terminated by schedule overlap policy",
720 > Identity: scheduler.identity(),
721 > FirstExecutionRunId: target.RunId,
722 > },
723 > }
724 > _, err := h.historyClient.TerminateWorkflowExecution(ctx, request)
725 > return err
726 > }
727
728 func (h *InvokerExecuteTaskHandler) cancelWorkflow(
730 scheduler *Scheduler,
731 target *commonpb.WorkflowExecution,
732 > ) error { invoker_tasks.go
733 > request := &historyservice.RequestCancelWorkflowExecutionRequest{
734 > NamespaceId: scheduler.NamespaceId,
735 > CancelRequest: &workflowservice.RequestCancelWorkflowExecutionRequest{
736 > Namespace: scheduler.Namespace,
737 > WorkflowExecution: &commonpb.WorkflowExecution{WorkflowId: target.WorkflowId},
738 > Reason: "cancelled by schedule overlap policy",
739 > Identity: scheduler.identity(),
740 > FirstExecutionRunId: target.RunId,
741 > },
742 > }
743 > _, err := h.historyClient.RequestCancelWorkflowExecution(ctx, request)
744 > return err
745 > }
746
747 // getRateLimiterPermission returns a delay for which the caller should wait
go.temporal.io/server/chasm/lib/scheduler/invoker.go 8 introduced LOC · 4 ranges

Open complete file

175 }
176 for _, wf := range result.CompletedCancels {
177 > canceled[wf.RunId] = true invoker.go
178 > }
179 for _, wf := range result.CompletedTerminates {
180 > terminated[wf.RunId] = true invoker.go
181 > }
182
183 // Remove failed (non-retryable) starts from the buffer.
194 canceled := canceled[we.RunId]
195 if canceled {
196 > removedStarts++ invoker.go
197 > }
198 return canceled
199 })
201 terminated := terminated[we.RunId]
202 if terminated {
203 > removedStarts++ invoker.go
204 > }
205 return terminated
206 })