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

Side by Side Diff: milo/appengine/common/model/status.go

Issue 2949783002: [milo] appengine/* -> * (Closed)
Patch Set: rebase Created 3 years, 6 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
« no previous file with comments | « milo/appengine/common/model/patch_info.go ('k') | milo/appengine/common/model/status_string.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file.
4
5 //go:generate stringer -type=Status
6
7 package model
8
9 import "encoding/json"
10
11 // Status is a discrete status for the purpose of colorizing a component.
12 // These are based off the Material Design Bootstrap color palettes.
13 type Status int
14
15 const (
16 // NotRun if the component has not yet been run.
17 NotRun Status = iota // 100 Gray
18
19 // Running if the component is currently running.
20 Running // 100 Teal
21
22 // Success if the component has finished executing and is not noteworthy .
23 Success // A200 Green
24
25 // Failure if the component has finished executing and contains a failur e.
26 Failure // A200 Red
27
28 // Warning just like from the buildbot days.
29 Warning // 200 Yellow
30
31 // InfraFailure if the component has finished incompletely due to a fail ure in infra.
32 InfraFailure // A100 Purple
33
34 // Exception if the component has finished incompletely and unexpectedly . This
35 // is used for buildbot builds.
36 Exception // A100 Purple
37
38 // Expired if the component was never scheduled due to resource exhausti on.
39 Expired // A200 Purple
40
41 // DependencyFailure if the component has finished incompletely due to a failure in a
42 // dependency.
43 DependencyFailure // 100 Amber
44
45 // WaitingDependency if the component has finished or paused execution d ue to an
46 // incomplete dep.
47 WaitingDependency // 100 Brown
48 )
49
50 // Terminal returns true if the step status won't change.
51 func (s Status) Terminal() bool {
52 switch s {
53 case Success, Failure, InfraFailure, Warning, DependencyFailure, Expired :
54 return true
55 default:
56 return false
57 }
58 }
59
60 // MarshalJSON renders enums into String rather than an int when marshalling.
61 func (s Status) MarshalJSON() ([]byte, error) {
62 return json.Marshal(s.String())
63 }
OLDNEW
« no previous file with comments | « milo/appengine/common/model/patch_info.go ('k') | milo/appengine/common/model/status_string.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698