Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(724)

Side by Side Diff: golden/go/diff/diff.go

Issue 1401563003: Enable clear/purge for failed digests (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 package diff 1 package diff
2 2
3 import ( 3 import (
4 "image" 4 "image"
5 "image/color" 5 "image/color"
6 "image/draw" 6 "image/draw"
7 "image/png" 7 "image/png"
8 "math" 8 "math"
9 "os" 9 "os"
10 "unsafe" 10 "unsafe"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 ) 81 )
82 82
83 // DigestFailure captures the details of a digest error that occured. 83 // DigestFailure captures the details of a digest error that occured.
84 type DigestFailure struct { 84 type DigestFailure struct {
85 Digest string `json:"digest"` 85 Digest string `json:"digest"`
86 Reason DiffErr `json:"reason"` 86 Reason DiffErr `json:"reason"`
87 TS int64 `json:"ts"` 87 TS int64 `json:"ts"`
88 Error string `json:"error"` 88 Error string `json:"error"`
89 } 89 }
90 90
91 // Implement sort.Interface for a slice of DigestFailure
92 type DigestFailureSlice []*DigestFailure
93
94 func (d DigestFailureSlice) Len() int { return len(d) }
95 func (d DigestFailureSlice) Less(i, j int) bool { return d[i].TS < d[j].TS }
96 func (d DigestFailureSlice) Swap(i, j int) { d[i], d[j] = d[j], d[i] }
97
91 type DiffStore interface { 98 type DiffStore interface {
92 // Get returns the DiffMetrics of the provided dMain digest vs all diges ts 99 // Get returns the DiffMetrics of the provided dMain digest vs all diges ts
93 // specified in dRest. 100 // specified in dRest.
94 Get(dMain string, dRest []string) (map[string]*DiffMetrics, error) 101 Get(dMain string, dRest []string) (map[string]*DiffMetrics, error)
95 102
96 // AbsPath returns the paths of the images that correspond to the given 103 // AbsPath returns the paths of the images that correspond to the given
97 // image digests. 104 // image digests.
98 AbsPath(digest []string) map[string]string 105 AbsPath(digest []string) map[string]string
99 106
100 // UnavailableDigests returns map[digest]*DigestFailure which can be use d 107 // UnavailableDigests returns map[digest]*DigestFailure which can be use d
101 // to check whether a digest could not be processed and to provide detai ls 108 // to check whether a digest could not be processed and to provide detai ls
102 // about failures. 109 // about failures.
103 UnavailableDigests() map[string]*DigestFailure 110 UnavailableDigests() map[string]*DigestFailure
104 111
105 // PurgeDigests removes all information related to the indicated digests 112 // PurgeDigests removes all information related to the indicated digests
106 // (image, diffmetric) from local caches. If purgeGS is true it will als o 113 // (image, diffmetric) from local caches. If purgeGS is true it will als o
107 // purge the digests image from Google storage, forcing that the digest 114 // purge the digests image from Google storage, forcing that the digest
108 // be re-uploaded by the build bots. 115 // be re-uploaded by the build bots.
109 » PurgeDigests(digests []string, purgeGS bool) 116 » PurgeDigests(digests []string, purgeGS bool) error
110 117
111 // SetDigestSets sets the sets of digests we want to compare grouped by 118 // SetDigestSets sets the sets of digests we want to compare grouped by
112 // names (usually test names). This sets the digests we are currently 119 // names (usually test names). This sets the digests we are currently
113 // interested in and removes digests (and their diffs) that we are no 120 // interested in and removes digests (and their diffs) that we are no
114 // longer interested in. 121 // longer interested in.
115 SetDigestSets(namedDigestSets map[string]map[string]bool) 122 SetDigestSets(namedDigestSets map[string]map[string]bool)
116 } 123 }
117 124
118 // OpenImage is a utility function that opens the specified file and returns an 125 // OpenImage is a utility function that opens the specified file and returns an
119 // image.Image 126 // image.Image
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } 305 }
299 } 306 }
300 } 307 }
301 308
302 return &DiffMetrics{ 309 return &DiffMetrics{
303 NumDiffPixels: numDiffPixels, 310 NumDiffPixels: numDiffPixels,
304 PixelDiffPercent: getPixelDiffPercent(numDiffPixels, totalPixels ), 311 PixelDiffPercent: getPixelDiffPercent(numDiffPixels, totalPixels ),
305 MaxRGBADiffs: maxRGBADiffs, 312 MaxRGBADiffs: maxRGBADiffs,
306 DimDiffer: (cmpWidth != resultWidth) || (cmpHeight != res ultHeight)}, resultImg 313 DimDiffer: (cmpWidth != resultWidth) || (cmpHeight != res ultHeight)}, resultImg
307 } 314 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698