Skip to content

Commit

Permalink
Expose pending workflow task information (#2416)
Browse files Browse the repository at this point in the history
  • Loading branch information
yycptt authored Jan 26, 2022
1 parent e5c7c7c commit a69c45c
Show file tree
Hide file tree
Showing 10 changed files with 581 additions and 426 deletions.
303 changes: 186 additions & 117 deletions api/cli/v1/message.pb.go

Large diffs are not rendered by default.

666 changes: 367 additions & 299 deletions api/historyservice/v1/request_response.pb.go

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ require (
go.opentelemetry.io/otel/sdk v1.2.0
go.opentelemetry.io/otel/sdk/export/metric v0.25.0
go.opentelemetry.io/otel/sdk/metric v0.25.0
go.temporal.io/api v1.7.1-0.20220125215924-b0b6d9286519
go.temporal.io/api v1.7.1-0.20220126215723-f2aa2e2ad71d
go.temporal.io/sdk v1.12.0
go.temporal.io/version v0.3.0
go.uber.org/atomic v1.9.0
Expand All @@ -54,7 +54,7 @@ require (
golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac
google.golang.org/api v0.59.0
google.golang.org/grpc v1.43.0
google.golang.org/grpc v1.44.0
google.golang.org/grpc/examples v0.0.0-20211021223902-4f21cde702d9
gopkg.in/square/go-jose.v2 v2.6.0
gopkg.in/validator.v2 v2.0.0-20210331031555-b37d688a7fb0
Expand Down Expand Up @@ -95,7 +95,7 @@ require (
golang.org/x/text v0.3.7 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220118154757-00ab72f36ad5 // indirect
google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
)
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,8 @@ go.opentelemetry.io/otel/trace v1.2.0 h1:Ys3iqbqZhcf28hHzrm5WAquMkDHNZTUkw7KHbuN
go.opentelemetry.io/otel/trace v1.2.0/go.mod h1:N5FLswTubnxKxOJHM7XZC074qpeEdLy3CgAVsdMucK0=
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
go.temporal.io/api v1.5.0/go.mod h1:BqKxEJJYdxb5dqf0ODfzfMxh8UEQ5L3zKS51FiIYYkA=
go.temporal.io/api v1.7.1-0.20220125215924-b0b6d9286519 h1:9M852+FVW9/7xdGbNCQvcxWmPbSGIy8ZsQM99gIhKsE=
go.temporal.io/api v1.7.1-0.20220125215924-b0b6d9286519/go.mod h1:2nsSl/a2TH28PFie4OIe4jKuKzaGJbfjlVc0XHz7uRs=
go.temporal.io/api v1.7.1-0.20220126215723-f2aa2e2ad71d h1:uqiiUinsGlZ7R6M74B8Md2XXbjkoinQdhbFrY7coh1o=
go.temporal.io/api v1.7.1-0.20220126215723-f2aa2e2ad71d/go.mod h1:Qy3l0Bw9C1RcToB+kfsI0lkrZYbDLgC9pzi6OYYJ/aE=
go.temporal.io/sdk v1.12.0 h1:QkqOpmgXVnHHCFP9HbSbyrF3jYgLBKY/3NdZyR7e5nQ=
go.temporal.io/sdk v1.12.0/go.mod h1:lSp3lH1lI0TyOsus0arnO3FYvjVXBZGi/G7DjnAnm6o=
go.temporal.io/version v0.3.0 h1:dMrei9l9NyHt8nG6EB8vAwDLLTwx2SvRyucCSumAiig=
Expand Down Expand Up @@ -861,8 +861,8 @@ google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEc
google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20211008145708-270636b82663/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20211016002631-37fc39342514/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20220118154757-00ab72f36ad5 h1:zzNejm+EgrbLfDZ6lu9Uud2IVvHySPl8vQzf04laR5Q=
google.golang.org/genproto v0.0.0-20220118154757-00ab72f36ad5/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350 h1:YxHp5zqIcAShDEvRr5/0rVESVS+njYF68PSdazrNLJo=
google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
Expand Down Expand Up @@ -890,8 +890,8 @@ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ
google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=
google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM=
google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg=
google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
google.golang.org/grpc/examples v0.0.0-20211021223902-4f21cde702d9 h1:oCTatYoJk72TQY+qm6mv9RvZlo9dp3SJJYVK4/ypTQs=
google.golang.org/grpc/examples v0.0.0-20211021223902-4f21cde702d9/go.mod h1:gID3PKrg7pWKntu9Ss6zTLJ0ttC0X9IHgREOCZwbCVU=
Expand Down
1 change: 1 addition & 0 deletions proto/internal/temporal/server/api/cli/v1/message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ message DescribeWorkflowExecutionResponse {
WorkflowExecutionInfo workflow_execution_info = 2;
repeated PendingActivityInfo pending_activities = 3;
repeated temporal.api.workflow.v1.PendingChildExecutionInfo pending_children = 4;
temporal.api.workflow.v1.PendingWorkflowTaskInfo pending_workflow_task = 5;
}

message WorkflowExecutionInfo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ message DescribeWorkflowExecutionResponse {
temporal.api.workflow.v1.WorkflowExecutionInfo workflow_execution_info = 2;
repeated temporal.api.workflow.v1.PendingActivityInfo pending_activities = 3;
repeated temporal.api.workflow.v1.PendingChildExecutionInfo pending_children = 4;
temporal.api.workflow.v1.PendingWorkflowTaskInfo pending_workflow_task = 5;
}

message ReplicateEventsV2Request {
Expand Down
1 change: 1 addition & 0 deletions service/frontend/workflowHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2699,6 +2699,7 @@ func (wh *WorkflowHandler) DescribeWorkflowExecution(ctx context.Context, reques
WorkflowExecutionInfo: response.GetWorkflowExecutionInfo(),
PendingActivities: response.GetPendingActivities(),
PendingChildren: response.GetPendingChildren(),
PendingWorkflowTask: response.GetPendingWorkflowTask(),
}, nil
}

Expand Down
14 changes: 14 additions & 0 deletions service/history/historyEngine.go
Original file line number Diff line number Diff line change
Expand Up @@ -1283,6 +1283,20 @@ func (e *historyEngineImpl) DescribeWorkflowExecution(
}
}

if di, ok := mutableState.GetPendingWorkflowTask(); ok {
pendingWorkflowTask := &workflowpb.PendingWorkflowTaskInfo{
State: enumspb.PENDING_WORKFLOW_TASK_STATE_SCHEDULED,
ScheduledTime: di.ScheduledTime,
OriginalScheduledTime: di.OriginalScheduledTime,
Attempt: di.Attempt,
}
if di.StartedID != common.EmptyEventID {
pendingWorkflowTask.State = enumspb.PENDING_WORKFLOW_TASK_STATE_STARTED
pendingWorkflowTask.StartedTime = di.StartedTime
}
result.PendingWorkflowTask = pendingWorkflowTask
}

return result, nil
}

Expand Down
1 change: 1 addition & 0 deletions tools/cli/workflowCommands.go
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,7 @@ func convertDescribeWorkflowExecutionResponse(resp *workflowservice.DescribeWork
WorkflowExecutionInfo: executionInfo,
PendingActivities: pendingActivitiesStr,
PendingChildren: resp.PendingChildren,
PendingWorkflowTask: resp.PendingWorkflowTask,
}
}

Expand Down

0 comments on commit a69c45c

Please sign in to comment.