Updated code to execute a SQL request to insert into workflow_executions.

This commit is contained in:
Aleksandr Melnikov
2020-04-14 12:25:22 -07:00
parent 9fb1da353b
commit ac8c3e39b1

View File

@@ -3,7 +3,6 @@ package server
import ( import (
"context" "context"
"errors" "errors"
"fmt"
"github.com/onepanelio/core/pkg/util" "github.com/onepanelio/core/pkg/util"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
"math" "math"
@@ -114,7 +113,16 @@ func (s *WorkflowServer) CreateWorkflowExecution(ctx context.Context, req *api.C
} }
func (s *WorkflowServer) AddWorkflowExecutionStatistics(ctx context.Context, request *api.AddWorkflowExecutionStatisticRequest) (*empty.Empty, error) { func (s *WorkflowServer) AddWorkflowExecutionStatistics(ctx context.Context, request *api.AddWorkflowExecutionStatisticRequest) (*empty.Empty, error) {
fmt.Printf("%v\n", request) client := ctx.Value("kubeClient").(*v1.Client)
workflowOutcomeIsSuccess := false
if request.Statistics.WorkflowStatus == "Success" {
workflowOutcomeIsSuccess = true
}
//todo createdAt parse
err := client.AddWorkflowExecutionStatistic(request.Namespace, request.Name, request.Statistics.WorkflowTemplateId, time.Now(), workflowOutcomeIsSuccess)
if err != nil {
return nil, err
}
return &empty.Empty{}, nil return &empty.Empty{}, nil
} }