diff --git a/api/api.swagger.json b/api/api.swagger.json index 1e1efcb..5cfa242 100644 --- a/api/api.swagger.json +++ b/api/api.swagger.json @@ -2253,6 +2253,10 @@ "type": "integer", "format": "int32" }, + "versions": { + "type": "integer", + "format": "int32" + }, "manifest": { "type": "string" }, diff --git a/api/workflow_template.pb.go b/api/workflow_template.pb.go index 437cd25..d5f1403 100644 --- a/api/workflow_template.pb.go +++ b/api/workflow_template.pb.go @@ -579,11 +579,12 @@ type WorkflowTemplate struct { Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"` Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` Version int32 `protobuf:"varint,4,opt,name=version,proto3" json:"version,omitempty"` - Manifest string `protobuf:"bytes,5,opt,name=manifest,proto3" json:"manifest,omitempty"` - IsLatest bool `protobuf:"varint,6,opt,name=isLatest,proto3" json:"isLatest,omitempty"` - IsArchived bool `protobuf:"varint,7,opt,name=isArchived,proto3" json:"isArchived,omitempty"` - Labels []*KeyValue `protobuf:"bytes,8,rep,name=labels,proto3" json:"labels,omitempty"` - Stats *WorkflowExecutionStatisticReport `protobuf:"bytes,9,opt,name=stats,proto3" json:"stats,omitempty"` + Versions int32 `protobuf:"varint,5,opt,name=versions,proto3" json:"versions,omitempty"` + Manifest string `protobuf:"bytes,6,opt,name=manifest,proto3" json:"manifest,omitempty"` + IsLatest bool `protobuf:"varint,7,opt,name=isLatest,proto3" json:"isLatest,omitempty"` + IsArchived bool `protobuf:"varint,8,opt,name=isArchived,proto3" json:"isArchived,omitempty"` + Labels []*KeyValue `protobuf:"bytes,9,rep,name=labels,proto3" json:"labels,omitempty"` + Stats *WorkflowExecutionStatisticReport `protobuf:"bytes,10,opt,name=stats,proto3" json:"stats,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -642,6 +643,13 @@ func (m *WorkflowTemplate) GetVersion() int32 { return 0 } +func (m *WorkflowTemplate) GetVersions() int32 { + if m != nil { + return m.Versions + } + return 0 +} + func (m *WorkflowTemplate) GetManifest() string { if m != nil { return m.Manifest @@ -759,68 +767,69 @@ func init() { func init() { proto.RegisterFile("workflow_template.proto", fileDescriptor_b9a07547748a96e8) } var fileDescriptor_b9a07547748a96e8 = []byte{ - // 975 bytes of a gzipped FileDescriptorProto + // 984 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x97, 0x4f, 0x6f, 0x1b, 0x45, 0x14, 0xc0, 0x35, 0x4e, 0x9d, 0xc6, 0xaf, 0x20, 0xa5, 0x0f, 0x92, 0x6c, 0x96, 0xa4, 0x35, 0xd3, 0x44, 0x72, 0x11, 0xb2, 0xd5, 0xc0, 0x29, 0x2d, 0xa2, 0x6e, 0x5a, 0x0a, 0x34, 0x07, 0xb4, 0xa5, 0x45, 0xea, 0x05, 0x26, 0xbb, 0xe3, 0x30, 0xea, 0x66, 0x77, 0xf1, 0x8c, 0x13, 0x4a, 0xb0, 0x44, - 0xe1, 0xc0, 0x8d, 0x0b, 0x7f, 0x04, 0x42, 0xea, 0x19, 0x89, 0x7e, 0x00, 0xce, 0x7c, 0x85, 0x7e, - 0x05, 0x38, 0xf0, 0x2d, 0xd0, 0xce, 0xee, 0x3a, 0xb1, 0xbd, 0x63, 0xbc, 0xb6, 0xe9, 0xcd, 0x33, - 0xf3, 0xf6, 0xcd, 0xef, 0xfd, 0x9b, 0xf7, 0x0c, 0x2b, 0x47, 0x61, 0xfb, 0x61, 0xcb, 0x0f, 0x8f, - 0x3e, 0x56, 0xfc, 0x20, 0xf2, 0x99, 0xe2, 0xf5, 0xa8, 0x1d, 0xaa, 0x10, 0xe7, 0x58, 0x24, 0xec, - 0xb5, 0xfd, 0x30, 0xdc, 0xf7, 0x79, 0x83, 0x45, 0xa2, 0xc1, 0x82, 0x20, 0x54, 0x4c, 0x89, 0x30, - 0x90, 0x89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c, 0x57, 0xf3, 0xec, 0xe5, 0x4c, 0x2c, 0x9b, 0xee, 0x07, 0xc4, + 0x82, 0x80, 0x89, 0x3b, 0xd3, 0x8a, 0xfd, 0x03, 0x81, 0xd5, 0xa6, 0xe7, 0x19, 0x00, 0x93, 0xc4, + 0x68, 0x7a, 0xde, 0x78, 0x40, 0xef, 0x6a, 0xa0, 0x9b, 0x74, 0x0a, 0xa0, 0xed, 0xac, 0x95, 0x78, + 0x42, 0x60, 0xdd, 0xe1, 0x91, 0xcf, 0x5c, 0x6e, 0x80, 0x5b, 0xd5, 0x14, 0xa9, 0x4c, 0x21, 0x40, + 0x7b, 0x16, 0x80, 0x3f, 0x12, 0x78, 0xe9, 0x26, 0x8f, 0xbb, 0xc3, 0x5c, 0x3e, 0x5c, 0xd1, 0x0c, + 0x89, 0x84, 0x9e, 0xf9, 0x2f, 0xb8, 0xb7, 0x35, 0xdc, 0x8d, 0x57, 0xae, 0x4f, 0x0e, 0xd7, 0x38, + 0x7e, 0xc8, 0x1f, 0x75, 0xf7, 0xe6, 0xf5, 0xaf, 0xf8, 0x6b, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, + 0xdf, 0xf3, 0x87, 0x10, 0xd5, 0x0f, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/api/workflow_template.proto b/api/workflow_template.proto index a9b2497..4dd9720 100644 --- a/api/workflow_template.proto +++ b/api/workflow_template.proto @@ -154,12 +154,13 @@ message WorkflowTemplate { string uid = 2; string name = 3; int32 version = 4; - string manifest = 5; - bool isLatest = 6; - bool isArchived = 7; - repeated KeyValue labels = 8; + int32 versions = 5; + string manifest = 6; + bool isLatest = 7; + bool isArchived = 8; + repeated KeyValue labels = 9; - WorkflowExecutionStatisticReport stats = 9; + WorkflowExecutionStatisticReport stats = 10; } message GetWorkflowTemplateLabelsRequest { diff --git a/db/20200420112057_cache_workflow_template_versions_count.sql b/db/20200420112057_cache_workflow_template_versions_count.sql new file mode 100644 index 0000000..8d4d7fd --- /dev/null +++ b/db/20200420112057_cache_workflow_template_versions_count.sql @@ -0,0 +1,7 @@ +-- +goose Up +ALTER TABLE workflow_templates ADD COLUMN versions INTEGER; +UPDATE workflow_templates SET versions = 1; +ALTER TABLE workflow_templates ALTER COLUMN versions SET NOT NULL; + +-- +goose Down +ALTER TABLE workflow_templates DROP COLUMN versions; \ No newline at end of file diff --git a/pkg/types.go b/pkg/types.go index bb7bd9f..aedf070 100644 --- a/pkg/types.go +++ b/pkg/types.go @@ -62,6 +62,7 @@ type WorkflowTemplate struct { Name string Manifest string Version int32 + Versions int32 `db:"versions"` IsLatest bool IsArchived bool `db:"is_archived"` ArgoWorkflowTemplate *wfv1.WorkflowTemplate @@ -70,11 +71,12 @@ type WorkflowTemplate struct { } type WorkflowExecutionStatisticReport struct { - Total int32 - LastExecuted time.Time - Running int32 - Completed int32 - Failed int32 + WorkflowTemplateId uint64 `db:"workflow_template_id"` + Total int32 + LastExecuted time.Time `db:"last_executed"` + Running int32 + Completed int32 + Failed int32 } type WorkflowExecutionStatistic struct { diff --git a/pkg/workflow_execution.go b/pkg/workflow_execution.go index 3c4866d..fec8213 100644 --- a/pkg/workflow_execution.go +++ b/pkg/workflow_execution.go @@ -1145,43 +1145,66 @@ func (c *Client) SetWorkflowTemplateLabels(namespace, name, prefix string, keyVa return filteredMap, nil } -func (c *Client) GetWorkflowExecutionStatisticsForTemplate(workflowTemplate *WorkflowTemplate) (err error) { +func (c *Client) GetWorkflowExecutionStatisticsForTemplates(workflowTemplates ...*WorkflowTemplate) (err error) { + if len(workflowTemplates) == 0 { + return errors.New("GetWorkflowExecutionStatisticsForTemplates requires at least 1 id") + } + tx, err := c.DB.Begin() if err != nil { return err } + + whereIn := "workflow_template_id IN (?" + for i := range workflowTemplates { + if i == 0 { + continue + } + + whereIn += ",?" + } + whereIn += ")" + + ids := make([]interface{}, len(workflowTemplates)) + for i, workflowTemplate := range workflowTemplates { + ids[i] = workflowTemplate.ID + } + defer tx.Rollback() - query, args, err := sb.Select("name, created_at, finished_at, failed_at"). - From("workflow_executions").Where(sq.Eq{"workflow_template_id": workflowTemplate.ID}).OrderBy("created_at DESC").ToSql() - if err != nil { - return err - } - var workflowExecStats []WorkflowExecutionStatistic - err = c.DB.Select(&workflowExecStats, query, args...) + statsSelect := ` + workflow_template_id, + MAX(created_at) last_executed, + COUNT(*) FILTER (WHERE finished_At IS NULL AND failed_at IS NULL) running, + COUNT(*) FILTER (WHERE finished_at IS NOT NULL) completed, + COUNT(*) FILTER (WHERE failed_at IS NOT NULL) failed, + COUNT(*) total` + + query, args, err := sb.Select(statsSelect). + From("workflow_executions"). + Where(whereIn, ids...). + GroupBy("workflow_template_id"). + ToSql() if err != nil { return err } - - workflowTemplate.WorkflowExecutionStatisticReport = &WorkflowExecutionStatisticReport{} - if len(workflowExecStats) == 0 { - return + result := make([]*WorkflowExecutionStatisticReport, 0) + err = c.DB.Select(&result, query, args...) + if err != nil { + return err } - //Calculate and set the values - workflowTemplate.WorkflowExecutionStatisticReport.Total = int32(len(workflowExecStats)) - createdAtTime := workflowExecStats[0].CreatedAt - workflowTemplate.WorkflowExecutionStatisticReport.LastExecuted = *createdAtTime - for _, workflowExecStat := range workflowExecStats { - if workflowExecStat.FailedAt != nil { - workflowTemplate.WorkflowExecutionStatisticReport.Failed++ - } else if workflowExecStat.FinishedAt == nil { - workflowTemplate.WorkflowExecutionStatisticReport.Running++ - } else if workflowExecStat.FinishedAt != nil { - workflowTemplate.WorkflowExecutionStatisticReport.Completed++ - } + resultMapping := make(map[uint64]*WorkflowExecutionStatisticReport) + for i := range result { + report := result[i] + resultMapping[report.WorkflowTemplateId] = report } + + for _, workflowTemplate := range workflowTemplates { + workflowTemplate.WorkflowExecutionStatisticReport = resultMapping[workflowTemplate.ID] + } + return } diff --git a/pkg/workflow_template.go b/pkg/workflow_template.go index b12b6cc..fe06e36 100644 --- a/pkg/workflow_template.go +++ b/pkg/workflow_template.go @@ -77,7 +77,7 @@ func (c *Client) createWorkflowTemplate(namespace string, workflowTemplate *Work } func (c *Client) workflowTemplatesSelectBuilder(namespace string) sq.SelectBuilder { - sb := sb.Select("wt.id", "wt.created_at", "wt.uid", "wt.name", "wt.is_archived"). + sb := sb.Select("wt.id", "wt.created_at", "wt.uid", "wt.name", "wt.is_archived", "wt.versions"). From("workflow_templates wt"). Where(sq.Eq{ "wt.namespace": namespace, @@ -183,6 +183,8 @@ func (c *Client) listWorkflowTemplateVersions(namespace, uid string) (workflowTe return nil, err } + labels := label.FilterByPrefix(label.TagPrefix, argoTemplate.Labels) + newItem := WorkflowTemplate{ ID: template.ID, CreatedAt: argoTemplate.CreationTimestamp.Time, @@ -192,6 +194,7 @@ func (c *Client) listWorkflowTemplateVersions(namespace, uid string) (workflowTe Version: int32(version), IsLatest: isLatest, IsArchived: template.IsArchived, + Labels: labels, } workflowTemplateVersions = append(workflowTemplateVersions, &newItem) @@ -238,6 +241,26 @@ func (c *Client) archiveWorkflowTemplate(namespace, uid string) (bool, error) { return true, nil } +func (c *Client) updateWorkflowTemplateVersions(namespace, uid string) (bool, error) { + query, args, err := sb.Update("workflow_templates"). + Set("versions", sq.Expr("versions + 1")). + Where(sq.Eq{ + "uid": uid, + "namespace": namespace, + }). + ToSql() + + if err != nil { + return false, err + } + + if _, err := c.DB.Exec(query, args...); err != nil { + return false, err + } + + return true, nil +} + func (c *Client) CreateWorkflowTemplate(namespace string, workflowTemplate *WorkflowTemplate) (*WorkflowTemplate, error) { // validate workflow template finalBytes, err := workflowTemplate.WrapSpec() @@ -327,6 +350,11 @@ func (c *Client) CreateWorkflowTemplateVersion(namespace string, workflowTemplat return nil, err } + _, err = c.updateWorkflowTemplateVersions(namespace, workflowTemplate.UID) + if err != nil { + return nil, err + } + return workflowTemplate, nil } @@ -389,15 +417,25 @@ func (c *Client) ListWorkflowTemplates(namespace string) (workflowTemplateVersio return nil, util.NewUserError(codes.NotFound, "Workflow templates not found.") } + err = c.GetWorkflowExecutionStatisticsForTemplates(workflowTemplateVersions...) + if err != nil { + log.WithFields(log.Fields{ + "Namespace": namespace, + "Error": err.Error(), + }).Error("Unable to get Workflow Execution Statistic for Templates.") + return nil, util.NewUserError(codes.NotFound, "Unable to get Workflow Execution Statistic for Templates.") + } for _, workflowTemplate := range workflowTemplateVersions { - err = c.GetWorkflowExecutionStatisticsForTemplate(workflowTemplate) + labels, err := c.GetWorkflowTemplateLabels(namespace, workflowTemplate.UID, label.TagPrefix, workflowTemplate.Version) if err != nil { log.WithFields(log.Fields{ "Namespace": namespace, "Error": err.Error(), - }).Error("Unable to get Workflow Execution Statistic for Template.") - return nil, util.NewUserError(codes.NotFound, "Unable to get Workflow Execution Statistic for Template.") + }).Error("Unable to get GetWorkflowTemplateLabels for Templates.") + continue } + + workflowTemplate.Labels = labels } return diff --git a/server/converter/converter.go b/server/converter/converter.go index 687392d..641118e 100644 --- a/server/converter/converter.go +++ b/server/converter/converter.go @@ -16,3 +16,16 @@ func APIKeyValueToLabel(apiKeyValues []*api.KeyValue) map[string]string { return result } + +func MappingToKeyValue(mapping map[string]string) []*api.KeyValue { + keyValues := make([]*api.KeyValue, 0) + + for key, value := range mapping { + keyValues = append(keyValues, &api.KeyValue{ + Key: key, + Value: value, + }) + } + + return keyValues +} diff --git a/server/workflow_template_server.go b/server/workflow_template_server.go index 2ce20ac..54055ab 100644 --- a/server/workflow_template_server.go +++ b/server/workflow_template_server.go @@ -29,9 +29,11 @@ func apiWorkflowTemplate(wft *v1.WorkflowTemplate) *api.WorkflowTemplate { CreatedAt: wft.CreatedAt.UTC().Format(time.RFC3339), Name: wft.Name, Version: wft.Version, + Versions: wft.Versions, Manifest: manifest, IsLatest: wft.IsLatest, IsArchived: wft.IsArchived, + Labels: converter.MappingToKeyValue(wft.Labels), } if wft.WorkflowExecutionStatisticReport != nil {