Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: add history event version and full detail options #817

Merged

Conversation

longquanzheng
Copy link
Contributor

Verified in my laptop:

/cadence --domain samples-domain wf show -w helloworld_cd0a6f79-fe03-487f-961b-2f3a15218d51 -prt -pev
  1  1528218647030568962  (Version: <nil>)  WorkflowExecutionStarted   (WorkflowType:(Name:main.Workflow),
                                                                        TaskList:(Name:helloWorldGroup),
                                                                        Input:["Cadence" ],
                                                                        ExecutionStartToCloseTimeoutSeconds:60,
                                                                        TaskStartToCloseTimeoutSeconds:60,
                                                                        Identity:65265@longer-C02V60N3HTDG@)
  2  1528218647030571247  (Version: <nil>)  DecisionTaskScheduled      (TaskList:(Name:helloWorldGroup),
                                                                        StartToCloseTimeoutSeconds:60,
                                                                        Attempt:0)
  3  1528218707035283749  (Version: <nil>)  WorkflowExecutionTimedOut  (TimeoutType:START_TO_CLOSE)
./cadence --domain samples-domain wf show -w helloworld_cd0a6f79-fe03-487f-961b-2f3a15218d51 -full -pev
  {"eventId":1,"timestamp":1528218647030568962,"eventType":"WorkflowExecutionStarted","workflowExecutionStartedEventAttributes":{"workflowType":{"name":"main.Workflow"},"taskList":{"name":"helloWorldGroup"},"input":"IkNhZGVuY2UiCg==","executionStartToCloseTimeoutSeconds":60,"taskStartToCloseTimeoutSeconds":60,"identity":"65265@longer-C02V60N3HTDG@"}}
  {"eventId":2,"timestamp":1528218647030571247,"eventType":"DecisionTaskScheduled","decisionTaskScheduledEventAttributes":{"taskList":{"name":"helloWorldGroup"},"startToCloseTimeoutSeconds":60,"attempt":0}}
  {"eventId":3,"timestamp":1528218707035283749,"eventType":"WorkflowExecutionTimedOut","workflowExecutionTimedOutEventAttributes":{"timeoutType":"START_TO_CLOSE"}}
./cadence --domain samples-domain wf show -w helloworld_cd0a6f79-fe03-487f-961b-2f3a15218d51 -pev
  1  (Version: <nil>)  WorkflowExecutionStarted   (WorkflowType:(Name:main.Workflow),
                                                   TaskList:(Name:helloWorldGroup),
                                                   Input:["Cadence" ],
                                                   ExecutionStartToCloseTimeoutSeconds:60,
                                                   TaskStartToCloseTimeoutSeconds:60,
                                                   Identity:65265@longer-C02V60N3HTDG@)
  2  (Version: <nil>)  DecisionTaskScheduled      (TaskList:(Name:helloWorldGroup),
                                                   StartToCloseTimeoutSeconds:60,
                                                   Attempt:0)
  3  (Version: <nil>)  WorkflowExecutionTimedOut  (TimeoutType:START_TO_CLOSE)

@vancexu vancexu changed the title CLI suuport: history event version and full detail options CLI: add history event version and full detail options Jun 5, 2018
FlagPrintEventVersion = "print_event_version"
FlagPrintEventVersionWithAlias = FlagPrintEventVersion + ", pev"
FlagPrintFullyDetail = "print_full"
FlagPrintFullyDetailWithAlias = FlagPrintFullyDetail + ", full"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe change alias "full" to "pf" to align with all other Print flags?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good idea.

@@ -383,13 +390,35 @@ func showHistoryHelper(c *cli.Context, wid, rid string) {
table.SetBorder(false)
table.SetColumnSeparator("")
for _, e := range history.Events {
columns := []string{}
if printFully {
jsonBs, err := json.Marshal(e)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also recursively decode the internal byte[] like "HistoryEventToString" did

jsonBs, err := json.Marshal(e)
var jsonStr string
if err != nil {
jsonStr = "ERROR!"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be better to add a little bit more info here like "Error when marshal event" so that customers won't be confused whether it is server error or CLI error.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, make sense

@longquanzheng
Copy link
Contributor Author

longer@~/gocode/src/github.com/uber/cadence:(hist-event-version)$ ./cadence --domain samples-domain wf show -w helloworld_cd0a6f79-fe03-487f-961b-2f3a15218d51 -pf
  (EventId:1,Timestamp:1528218647030568962,EventType:WorkflowExecutionStarted,WorkflowExecutionStartedEventAttributes:(WorkflowType:(Name:main.Workflow),TaskList:(Name:helloWorldGroup),Input:["Cadence"
  ],ExecutionStartToCloseTimeoutSeconds:60,TaskStartToCloseTimeoutSeconds:60,Identity:65265@longer-C02V60N3HTDG@))
  (EventId:2,Timestamp:1528218647030571247,EventType:DecisionTaskScheduled,DecisionTaskScheduledEventAttributes:(TaskList:(Name:helloWorldGroup),StartToCloseTimeoutSeconds:60,Attempt:0))
  (EventId:3,Timestamp:1528218707035283749,EventType:WorkflowExecutionTimedOut,WorkflowExecutionTimedOutEventAttributes:(TimeoutType:START_TO_CLOSE))
longer@~/gocode/src/github.com/uber/cadence:(hist-event-version)$
longer@~/gocode/src/github.com/uber/cadence:(hist-event-version)$
longer@~/gocode/src/github.com/uber/cadence:(hist-event-version)$ ./cadence --domain samples-domain wf show -w helloworld_cd0a6f79-fe03-487f-961b-2f3a15218d51
  1  WorkflowExecutionStarted   (WorkflowType:(Name:main.Workflow),TaskList:(Name:helloWorldGroup),Input:["Cadence"
                                 ],ExecutionStartToCloseTimeoutSeconds:60,TaskStartToCloseTimeoutSeconds:60,Identity:65265@longer-C02V60N3HTDG@)
  2  DecisionTaskScheduled      (TaskList:(Name:helloWorldGroup),StartToCloseTimeoutSeconds:60,Attempt:0)
  3  WorkflowExecutionTimedOut  (TimeoutType:START_TO_CLOSE)
longer@~/gocode/src/github.com/uber/cadence:(hist-event-version)$ ./cadence --domain samples-domain wf show -w helloworld_cd0a6f79-fe03-487f-961b-2f3a15218d51 -pdt
  1  2018-06-05T10:10:47-07:00  WorkflowExecutionStarted   (WorkflowType:(Name:main.Workflow),TaskList:(Name:helloWorldGroup),Input:["Cadence"
                                                            ],ExecutionStartToCloseTimeoutSeconds:60,TaskStartToCloseTimeoutSeconds:60,Identity:65265@longer-C02V60N3HTDG@)
  2  2018-06-05T10:10:47-07:00  DecisionTaskScheduled      (TaskList:(Name:helloWorldGroup),StartToCloseTimeoutSeconds:60,Attempt:0)
  3  2018-06-05T10:11:47-07:00  WorkflowExecutionTimedOut  (TimeoutType:START_TO_CLOSE)
longer@~/gocode/src/github.com/uber/cadence:(hist-event-version)$

@longquanzheng longquanzheng merged commit 5f40ae1 into cadence-workflow:master Jun 6, 2018
@longquanzheng longquanzheng deleted the hist-event-version branch January 5, 2020 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants