Skip to content

Commit 1a88da6

Browse files
authored
Fix for DescribeWorkflow (#773)
<!--- Note to EXTERNAL Contributors --> <!-- Thanks for opening a PR! If it is a significant code change, please **make sure there is an open issue** for this. We work best with you when we have accepted the idea first before you code. --> <!--- For ALL Contributors 👇 --> ## What was changed <!-- Describe what has changed in this PR --> Check if extended info is not nil. ## Why? <!-- Tell your future self why have you made these changes --> #771 Code assumes that some extended info exists in proto. Which is not true for older server versions..
1 parent 57e8cec commit 1a88da6

1 file changed

Lines changed: 46 additions & 39 deletions

File tree

temporalcli/commands.workflow_view.go

Lines changed: 46 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -102,49 +102,56 @@ func (c *TemporalWorkflowDescribeCommand) run(cctx *CommandContext, args []strin
102102

103103
cctx.Printer.Println(color.MagentaString("Execution Info:"))
104104
info := resp.WorkflowExecutionInfo
105-
extendedInfo := resp.WorkflowExtendedInfo
106105
_ = cctx.Printer.PrintStructured(struct {
107-
WorkflowId string
108-
RunId string
109-
Type string
110-
Namespace string
111-
TaskQueue string
112-
AssignedBuildId string
113-
StartTime time.Time
114-
CloseTime time.Time `cli:",cardOmitEmpty"`
115-
ExecutionTime time.Time `cli:",cardOmitEmpty"`
116-
Memo map[string]*common.Payload `cli:",cardOmitEmpty"`
117-
SearchAttributes map[string]*common.Payload `cli:",cardOmitEmpty"`
118-
StateTransitionCount int64
119-
HistoryLength int64
120-
HistorySize int64
121-
ExecutionExpirationTime time.Time `cli:",cardOmitEmpty"`
122-
RunExpirationTime time.Time `cli:",cardOmitEmpty"`
123-
CancelRequested bool
124-
LastResetTime time.Time `cli:",cardOmitEmpty"`
125-
OriginalStartTime time.Time `cli:",cardOmitEmpty"`
106+
WorkflowId string
107+
RunId string
108+
Type string
109+
Namespace string
110+
TaskQueue string
111+
AssignedBuildId string
112+
StartTime time.Time
113+
CloseTime time.Time `cli:",cardOmitEmpty"`
114+
ExecutionTime time.Time `cli:",cardOmitEmpty"`
115+
Memo map[string]*common.Payload `cli:",cardOmitEmpty"`
116+
SearchAttributes map[string]*common.Payload `cli:",cardOmitEmpty"`
117+
StateTransitionCount int64
118+
HistoryLength int64
119+
HistorySize int64
126120
}{
127-
WorkflowId: info.Execution.WorkflowId,
128-
RunId: info.Execution.RunId,
129-
Type: info.Type.GetName(),
130-
Namespace: c.Parent.Namespace,
131-
TaskQueue: info.TaskQueue,
132-
AssignedBuildId: info.GetAssignedBuildId(),
133-
StartTime: timestampToTime(info.StartTime),
134-
CloseTime: timestampToTime(info.CloseTime),
135-
ExecutionTime: timestampToTime(info.ExecutionTime),
136-
Memo: info.Memo.GetFields(),
137-
SearchAttributes: info.SearchAttributes.GetIndexedFields(),
138-
StateTransitionCount: info.StateTransitionCount,
139-
HistoryLength: info.HistoryLength,
140-
HistorySize: info.HistorySizeBytes,
141-
ExecutionExpirationTime: timestampToTime(extendedInfo.ExecutionExpirationTime),
142-
RunExpirationTime: timestampToTime(extendedInfo.RunExpirationTime),
143-
CancelRequested: extendedInfo.CancelRequested,
144-
LastResetTime: timestampToTime(extendedInfo.LastResetTime),
145-
OriginalStartTime: timestampToTime(extendedInfo.OriginalStartTime),
121+
WorkflowId: info.Execution.WorkflowId,
122+
RunId: info.Execution.RunId,
123+
Type: info.Type.GetName(),
124+
Namespace: c.Parent.Namespace,
125+
TaskQueue: info.TaskQueue,
126+
AssignedBuildId: info.GetAssignedBuildId(),
127+
StartTime: timestampToTime(info.StartTime),
128+
CloseTime: timestampToTime(info.CloseTime),
129+
ExecutionTime: timestampToTime(info.ExecutionTime),
130+
Memo: info.Memo.GetFields(),
131+
SearchAttributes: info.SearchAttributes.GetIndexedFields(),
132+
StateTransitionCount: info.StateTransitionCount,
133+
HistoryLength: info.HistoryLength,
134+
HistorySize: info.HistorySizeBytes,
146135
}, printer.StructuredOptions{})
147136

137+
extendedInfo := resp.WorkflowExtendedInfo
138+
if extendedInfo != nil {
139+
cctx.Printer.Println(color.MagentaString("Extended Execution Info:"))
140+
_ = cctx.Printer.PrintStructured(struct {
141+
CancelRequested bool
142+
ExecutionExpirationTime time.Time `cli:",cardOmitEmpty"`
143+
RunExpirationTime time.Time `cli:",cardOmitEmpty"`
144+
LastResetTime time.Time `cli:",cardOmitEmpty"`
145+
OriginalStartTime time.Time `cli:",cardOmitEmpty"`
146+
}{
147+
CancelRequested: extendedInfo.CancelRequested,
148+
ExecutionExpirationTime: timestampToTime(extendedInfo.ExecutionExpirationTime),
149+
RunExpirationTime: timestampToTime(extendedInfo.RunExpirationTime),
150+
LastResetTime: timestampToTime(extendedInfo.LastResetTime),
151+
OriginalStartTime: timestampToTime(extendedInfo.OriginalStartTime),
152+
}, printer.StructuredOptions{})
153+
}
154+
148155
staticSummary := resp.GetExecutionConfig().GetUserMetadata().GetSummary()
149156
staticDetails := resp.GetExecutionConfig().GetUserMetadata().GetDetails()
150157
if len(staticSummary.GetData()) > 0 || len(staticDetails.GetData()) > 0 {

0 commit comments

Comments
 (0)