Skip to content

Commit

Permalink
Add index range selection
Browse files Browse the repository at this point in the history
  • Loading branch information
suprjinx committed Jul 30, 2024
1 parent 55ff88d commit 52608b5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
10 changes: 10 additions & 0 deletions pkg/api/aim/api/request/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,16 @@ func (req SearchArtifactsRequest) RecordRangeMax() int {
return rangeMax(req.RecordRange)
}

// IndexRangeMin returns the low end of the index range.
func (req SearchArtifactsRequest) IndexRangeMin() int {
return rangeMin(req.IndexRange)
}

// IndexRangeMax returns the high end of the index range.
func (req SearchArtifactsRequest) IndexRangeMax() int {
return rangeMax(req.IndexRange)
}

// rangeMin will extract the lower end of a range string in the request.
func rangeMin(r string) int {
rangeVals := strings.Split(r, ":")
Expand Down
7 changes: 6 additions & 1 deletion pkg/api/aim/dao/repositories/artifact.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,13 @@ func (r ArtifactRepository) Search(
FROM artifacts
WHERE run_uuid IN (?)
AND step BETWEEN ? AND ?
AND "index" BETWEEN ? AND ?
GROUP BY run_uuid, name, step;`,
runIDs, req.RecordRangeMin(), req.RecordRangeMax()).
runIDs,
req.RecordRangeMin(),
req.RecordRangeMax(),
req.IndexRangeMin(),
req.IndexRangeMax()).
Find(&stepInfo); tx.Error != nil {
return nil, nil, nil, eris.Wrap(err, "error find result summary for artifact search")
}
Expand Down

0 comments on commit 52608b5

Please sign in to comment.