feat(backend): sorting on run metrics - step 1 (#4203)
* enable pagination when expanding experiment in both the home page and the archive page
* Revert "enable pagination when expanding experiment in both the home page and the archive page"
This reverts commit 5b672739dd.
* metrics as the outermost
* columns swap
This commit is contained in:
parent
1a60c02660
commit
a96e8fe94e
|
|
@ -214,19 +214,18 @@ func (s *RunStore) GetRun(runId string) (*model.RunDetail, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *RunStore) addMetricsAndResourceReferences(filteredSelectBuilder sq.SelectBuilder) sq.SelectBuilder {
|
func (s *RunStore) addMetricsAndResourceReferences(filteredSelectBuilder sq.SelectBuilder) sq.SelectBuilder {
|
||||||
metricConcatQuery := s.db.Concat([]string{`"["`, s.db.GroupConcat("m.Payload", ","), `"]"`}, "")
|
resourceRefConcatQuery := s.db.Concat([]string{`"["`, s.db.GroupConcat("rr.Payload", ","), `"]"`}, "")
|
||||||
subQ := sq.
|
subQ := sq.
|
||||||
Select("rd.*", metricConcatQuery+" AS metrics").
|
Select("rd.*", resourceRefConcatQuery+" AS refs").
|
||||||
FromSelect(filteredSelectBuilder, "rd").
|
FromSelect(filteredSelectBuilder, "rd").
|
||||||
LeftJoin("run_metrics AS m ON rd.UUID=m.RunUUID").
|
LeftJoin("resource_references AS rr ON rr.ResourceType='Run' AND rd.UUID=rr.ResourceUUID").
|
||||||
GroupBy("rd.UUID")
|
GroupBy("rd.UUID")
|
||||||
|
|
||||||
resourceRefConcatQuery := s.db.Concat([]string{`"["`, s.db.GroupConcat("r.Payload", ","), `"]"`}, "")
|
metricConcatQuery := s.db.Concat([]string{`"["`, s.db.GroupConcat("rm.Payload", ","), `"]"`}, "")
|
||||||
return sq.
|
return sq.
|
||||||
Select("subq.*", resourceRefConcatQuery+" AS refs").
|
Select("subq.*", metricConcatQuery+" AS metrics").
|
||||||
FromSelect(subQ, "subq").
|
FromSelect(subQ, "subq").
|
||||||
// Append all the resource references for the run as a json column
|
LeftJoin("run_metrics AS rm ON subq.UUID=rm.RunUUID").
|
||||||
LeftJoin("resource_references AS r ON r.ResourceType='Run' AND subq.UUID=r.ResourceUUID").
|
|
||||||
GroupBy("subq.UUID")
|
GroupBy("subq.UUID")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -258,8 +257,8 @@ func (s *RunStore) scanRowsToRunDetails(rows *sql.Rows) ([]*model.RunDetail, err
|
||||||
¶meters,
|
¶meters,
|
||||||
&pipelineRuntimeManifest,
|
&pipelineRuntimeManifest,
|
||||||
&workflowRuntimeManifest,
|
&workflowRuntimeManifest,
|
||||||
&metricsInString,
|
|
||||||
&resourceReferencesInString,
|
&resourceReferencesInString,
|
||||||
|
&metricsInString,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Failed to scan row: %v", err)
|
glog.Errorf("Failed to scan row: %v", err)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue