Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Merge ebae8c8 into 15d5c7b
Browse files Browse the repository at this point in the history
  • Loading branch information
katrogan authored May 30, 2023
2 parents 15d5c7b + ebae8c8 commit fcc599b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/manager/impl/node_execution_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,18 @@ func (m *NodeExecutionManager) listNodeExecutions(
if len(output.NodeExecutions) == int(limit) {
token = strconv.Itoa(offset + len(output.NodeExecutions))
}
logger.Infof(ctx, "using [%s] as pagination token", token)
logger.Infof(ctx, "transforming node executions [%+v]", output.NodeExecutions)
nodeExecutionList, err := m.transformNodeExecutionModelList(ctx, output.NodeExecutions)
if err != nil {
logger.Debugf(ctx, "failed to transform node execution models for request with err: %v", err)
return nil, err
}
logger.Infof(ctx, "node execution models are [%+v]", nodeExecutionList)
logger.Infof(ctx, "would return response [%+v]", &admin.NodeExecutionList{
NodeExecutions: nodeExecutionList,
Token: token,
})

return &admin.NodeExecutionList{
NodeExecutions: nodeExecutionList,
Expand Down
3 changes: 3 additions & 0 deletions pkg/repositories/transformers/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,11 +342,14 @@ func FromExecutionModel(ctx context.Context, executionModel models.Execution, op
if err = proto.Unmarshal(executionModel.Closure, &closure); err != nil {
return nil, errors.NewFlyteAdminErrorf(codes.Internal, "failed to unmarshal closure")
}
logger.Infof(ctx, "possibly trimming error message for [%+v]", executionModel.ExecutionKey)
if closure.GetError() != nil && opts != nil && opts.TrimErrorMessage && len(closure.GetError().Message) > 0 {
trimmedErrOutputResult := closure.GetError()
logger.Infof(ctx, "overwriting original error message [%+v]", trimmedErrOutputResult.Message)
if len(trimmedErrOutputResult.Message) > trimmedErrMessageLen {
trimmedErrOutputResult.Message = trimmedErrOutputResult.Message[0:trimmedErrMessageLen]
}
logger.Infof(ctx, "with trimmed message [%+v]", trimmedErrOutputResult)
closure.OutputResult = &admin.ExecutionClosure_Error{
Error: trimmedErrOutputResult,
}
Expand Down
6 changes: 6 additions & 0 deletions pkg/repositories/transformers/node_execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,17 @@ func FromNodeExecutionModel(nodeExecutionModel models.NodeExecution, opts *Execu
if err != nil {
return nil, errors.NewFlyteAdminErrorf(codes.Internal, "failed to unmarshal closure")
}

ctx := context.TODO()
logger.Infof(ctx, "possibly trimming error message for [%+v]", nodeExecutionModel.NodeExecutionKey)
if closure.GetError() != nil && opts != nil && opts.TrimErrorMessage && len(closure.GetError().Message) > 0 {
trimmedErrOutputResult := closure.GetError()

logger.Infof(context.TODO(), "overwriting original error message [%+v]", trimmedErrOutputResult.Message)
if len(trimmedErrOutputResult.Message) > trimmedErrMessageLen {
trimmedErrOutputResult.Message = trimmedErrOutputResult.Message[0:trimmedErrMessageLen]
}
logger.Infof(ctx, "with trimmed message [%+v]", trimmedErrOutputResult)
closure.OutputResult = &admin.NodeExecutionClosure_Error{
Error: trimmedErrOutputResult,
}
Expand Down

0 comments on commit fcc599b

Please sign in to comment.