api.go ×8

Frontier kind: Code frontier

unlabeled · c_20c39994fe4a

10 tests · 9110 LOC · 245 files · introduces 0 tests · 62 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
9 ranges62 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1971 ranges9110 lines · 245 files · Browse complete extent
All tests (intent)
10 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: 62 introduced LOC across 9 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/api/respondworkflowtaskcompleted/api.go 59 introduced LOC · 8 ranges

Open complete file

486 wtFailedShouldCreateNewTask := false
487 if wtFailedCause != nil {
488 > effects.Cancel(ctx) api.go
489 >
490 > // Abort all Updates with explicit reason, to prevent them to be aborted with generic
491 > // registryClearedErr, which may lead to continuous retries of UpdateWorkflowExecution API.
492 > updateRegistry.Abort(update.AbortReasonWorkflowTaskFailed)
493 >
494 > metrics.FailedWorkflowTasksCounter.With(handler.metricsHandler).Record(
495 > 1,
496 > metrics.OperationTag(metrics.HistoryRespondWorkflowTaskCompletedScope),
497 > metrics.NamespaceTag(namespaceEntry.Name().String()),
498 > metrics.VersioningBehaviorTag(ms.GetEffectiveVersioningBehavior()),
499 > metrics.FailureTag(wtFailedCause.failedCause.String()),
500 > metrics.FirstAttemptTag(currentWorkflowTask.Attempt),
501 > )
502 > handler.logger.Info("Failing the workflow task.",
503 > tag.Value(wtFailedCause.Message()),
504 > tag.WorkflowID(token.GetWorkflowId()),
505 > tag.WorkflowRunID(token.GetRunId()),
506 > tag.WorkflowNamespaceID(namespaceEntry.ID().String()),
507 > tag.Attempt(currentWorkflowTask.Attempt),
508 > tag.Cause(wtFailedCause.failedCause.String()),
509 > )
510 > if currentWorkflowTask.Attempt > 1 && wtFailedCause.failedCause != enumspb.WORKFLOW_TASK_FAILED_CAUSE_UNHANDLED_COMMAND {
511 // drop this workflow task if it keeps failing. This will cause the workflow task to timeout and get retried after timeout.
512 return nil, serviceerror.NewInvalidArgument(wtFailedCause.Message())
513 }
514
515 > ms, _, err = failWorkflowTask(ctx, handler.shardContext, weContext, currentWorkflowTask, wtFailedCause, request) api.go
516 > if err != nil {
517 return nil, err
518 }
519 > wtFailedShouldCreateNewTask = true api.go
520 > newMutableState = nil
521 >
522 > if wtFailedCause.terminateWorkflow {
523 // Flush buffer event before terminating the workflow
524 ms.FlushBufferedEvents()
774
775 if wtFailedCause != nil {
776 > // Mutable state was already persisted and doesn't need to be cleared although error is returned to the worker. api.go
777 > releaseLeaseWithError = false
778 > return nil, serviceerror.NewInvalidArgument(wtFailedCause.Message())
779 > }
780
781 resp := &historyservice.RespondWorkflowTaskCompletedResponse{}
1118 wtFailedCause *workflowTaskFailedCause,
1119 request *workflowservice.RespondWorkflowTaskCompletedRequest,
1120 > ) (historyi.MutableState, int64, error) { api.go
1121 >
1122 > // clear any updates we have accumulated so far
1123 > wfContext.Clear()
1124 >
1125 > // Reload workflow execution so we can apply the workflow task failure event
1126 > mutableState, err := wfContext.LoadMutableState(ctx, shardContext)
1127 > if err != nil {
1128 return nil, common.EmptyEventID, err
1129 }
1130 > wtFailedEvent, err := mutableState.AddWorkflowTaskFailedEvent( api.go
1131 > workflowTask,
1132 > wtFailedCause.failedCause,
1133 > failure.NewServerFailure(wtFailedCause.Message(), false),
1134 > request.GetIdentity(),
1135 > nil,
1136 > request.GetBinaryChecksum(),
1137 > "",
1138 > "",
1139 > 0,
1140 > )
1141 > if err != nil {
1142 return nil, common.EmptyEventID, err
1143 }
1144
1145 > var wtFailedEventID int64 api.go
1146 > if wtFailedEvent != nil {
1147 > // If WTFailed event was added to the history then use its Id as wtFailedEventID.
1148 > wtFailedEventID = wtFailedEvent.GetEventId()
1149 > } else {
1150 // Otherwise, if it was transient WT, last event should be WTFailed event from the 1st attempt.
1151 wtFailedEventID = mutableState.GetNextEventID() - 1
1153
1154 // Return reloaded mutable state back to the caller for further updates.
1155 > return mutableState, wtFailedEventID, nil api.go
1156 }
1157
go.temporal.io/server/service/history/api/respondworkflowtaskcompleted/workflow_task_completed_handler.go 3 introduced LOC · 1 range

Open complete file

1605 }
1606
1607 > func (c *workflowTaskFailedCause) Message() string { workflow_task_completed_handler.go
1608 >
1609 > if c.causeErr == nil {
1610 return c.failedCause.String()
1611 }