From ebae8c82d1cb7c758ff99b63e6319c860404fd7e Mon Sep 17 00:00:00 2001 From: Katrina Rogan Date: Tue, 30 May 2023 10:58:53 -0700 Subject: [PATCH] Add some logging Signed-off-by: Katrina Rogan --- pkg/manager/impl/node_execution_manager.go | 7 +++++++ pkg/repositories/transformers/execution.go | 3 +++ pkg/repositories/transformers/node_execution.go | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/pkg/manager/impl/node_execution_manager.go b/pkg/manager/impl/node_execution_manager.go index bcc4362db..1e29d7e8d 100644 --- a/pkg/manager/impl/node_execution_manager.go +++ b/pkg/manager/impl/node_execution_manager.go @@ -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, diff --git a/pkg/repositories/transformers/execution.go b/pkg/repositories/transformers/execution.go index f9e626ebf..4b17217d6 100644 --- a/pkg/repositories/transformers/execution.go +++ b/pkg/repositories/transformers/execution.go @@ -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, } diff --git a/pkg/repositories/transformers/node_execution.go b/pkg/repositories/transformers/node_execution.go index f1d90361f..fbaf36b52 100644 --- a/pkg/repositories/transformers/node_execution.go +++ b/pkg/repositories/transformers/node_execution.go @@ -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, }