Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions client/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ func ExecuteOperationMetadata(op *longrunning.Operation) (*reapi.ExecuteOperatio
m := op.Metadata
em := &reapi.ExecuteOperationMetadata{}
qm := &bfpb.QueuedOperationMetadata{}
if ptypes.Is(m, em) {
if m.MessageIs(em) {
if err := ptypes.UnmarshalAny(m, em); err != nil {
return nil, err
}
return em, nil
} else if ptypes.Is(m, qm) {
} else if m.MessageIs(qm) {
if err := ptypes.UnmarshalAny(m, qm); err != nil {
return nil, err
}
Expand All @@ -37,9 +37,9 @@ func RequestMetadata(o *longrunning.Operation) *reapi.RequestMetadata {
m := o.Metadata
em := &reapi.ExecuteOperationMetadata{}
qm := &bfpb.QueuedOperationMetadata{}
if ptypes.Is(m, em) {
if m.MessageIs(em) {
return nil
} else if ptypes.Is(m, qm) {
} else if m.MessageIs(qm) {
if err := ptypes.UnmarshalAny(m, qm); err != nil {
return nil
} else {
Expand All @@ -54,7 +54,7 @@ func ExecutedActionMetadata(o *longrunning.Operation) (*reapi.ExecutedActionMeta
switch r := o.Result.(type) {
case *longrunning.Operation_Response:
er := &reapi.ExecuteResponse{}
if ptypes.Is(r.Response, er) {
if r.Response.MessageIs(er) {
err := ptypes.UnmarshalAny(r.Response, er)
if err == nil && er.Result != nil {
if er.Result.ExecutionMetadata == nil {
Expand Down
27 changes: 18 additions & 9 deletions view/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,57 +272,66 @@ func renderExecutedActionMetadata(em *reapi.ExecutedActionMetadata, workerSelect
}
var qt, wst, wct, ifst, ifct, est, ect, oust, ouct time.Time
var err error
if qt, err = ptypes.Timestamp(em.QueuedTimestamp); err != nil {
if err = em.QueuedTimestamp.CheckValid(); err != nil {
text += err.Error() + "\n"
return text
}
qt = em.QueuedTimestamp.AsTime()
if em.WorkerStartTimestamp != nil {
if wst, err = ptypes.Timestamp(em.WorkerStartTimestamp); err != nil {
if err = em.WorkerStartTimestamp.CheckValid(); err != nil {
text += err.Error() + "\n"
return text
}
wst = em.WorkerStartTimestamp.AsTime()
}
if em.WorkerCompletedTimestamp != nil {
if wct, err = ptypes.Timestamp(em.WorkerCompletedTimestamp); err != nil {
if err = em.WorkerCompletedTimestamp.CheckValid(); err != nil {
text += err.Error() + "\n"
return text
}
wct = em.WorkerCompletedTimestamp.AsTime()
}
if em.InputFetchStartTimestamp != nil {
if ifst, err = ptypes.Timestamp(em.InputFetchStartTimestamp); err != nil {
if err = em.InputFetchStartTimestamp.CheckValid(); err != nil {
text += err.Error() + "\n"
return text
}
ifst = em.InputFetchStartTimestamp.AsTime()
}
if em.InputFetchCompletedTimestamp != nil {
if ifct, err = ptypes.Timestamp(em.InputFetchCompletedTimestamp); err != nil {
if err = em.InputFetchCompletedTimestamp.CheckValid(); err != nil {
text += err.Error() + "\n"
return text
}
ifct = em.InputFetchCompletedTimestamp.AsTime()
}
if em.ExecutionStartTimestamp != nil {
if est, err = ptypes.Timestamp(em.ExecutionStartTimestamp); err != nil {
if err = em.ExecutionStartTimestamp.CheckValid(); err != nil {
text += err.Error() + "\n"
return text
}
est = em.ExecutionStartTimestamp.AsTime()
}
if em.ExecutionCompletedTimestamp != nil {
if ect, err = ptypes.Timestamp(em.ExecutionCompletedTimestamp); err != nil {
if err = em.ExecutionCompletedTimestamp.CheckValid(); err != nil {
text += err.Error() + "\n"
return text
}
ect = em.ExecutionCompletedTimestamp.AsTime()
}
if em.OutputUploadStartTimestamp != nil {
if oust, err = ptypes.Timestamp(em.OutputUploadStartTimestamp); err != nil {
if err = em.OutputUploadStartTimestamp.CheckValid(); err != nil {
text += err.Error() + "\n"
return text
}
oust = em.OutputUploadStartTimestamp.AsTime()
}
if em.OutputUploadCompletedTimestamp != nil {
if ouct, err = ptypes.Timestamp(em.OutputUploadCompletedTimestamp); err != nil {
if err = em.OutputUploadCompletedTimestamp.CheckValid(); err != nil {
text += err.Error() + "\n"
return text
}
ouct = em.OutputUploadCompletedTimestamp.AsTime()
}
text += fmt.Sprintf("queued at: %s\n", formatTime(qt))
var qstall time.Duration
Expand Down