@@ -20,7 +20,6 @@ import (
2020 "fmt"
2121 "net/url"
2222 "path"
23- "regexp"
2423 "strconv"
2524 "strings"
2625
@@ -62,7 +61,7 @@ func JoinTrialName(e *Experiment, number int64) string {
6261
6362// SplitTrialName provides a consistent experience when trying to split a "trial name" into an experiment
6463// name and a trial number. When the provided name does not contain a number, the resulting number will
65- // be less then zero.
64+ // be less than zero.
6665func SplitTrialName (name string ) (ExperimentName , int64 ) {
6766 // Names with slashes are always split (since the slash can't be in the name)
6867 p := strings .LastIndex (name , "/" )
@@ -84,27 +83,3 @@ func SplitTrialName(name string) (ExperimentName, int64) {
8483
8584 return ExperimentName (name ), - 1
8685}
87-
88- // nameRegexp is used to validate the experiment labels that are required to be names.
89- var nameRegexp = regexp .MustCompile (`^[a-z\d](?:[-a-z\d]{0,61}[a-z\d])?$` )
90-
91- // CheckLabels ensures the supplied experiment labels are valid.
92- func CheckLabels (labels map [string ]string ) error {
93- if v , ok := labels ["application" ]; ! ok {
94- return fmt .Errorf ("missing required label: application" )
95- } else if ! nameRegexp .MatchString (v ) {
96- return fmt .Errorf ("invalid label value (must be lowercase): application=%q" , v )
97- }
98-
99- if v , ok := labels ["scenario" ]; ! ok {
100- return fmt .Errorf ("missing required label: scenario" )
101- } else if ! nameRegexp .MatchString (v ) {
102- return fmt .Errorf ("invalid label value (must be lowercase): scenario=%q" , v )
103- }
104-
105- if v , ok := labels ["objective" ]; ok && ! nameRegexp .MatchString (v ) {
106- return fmt .Errorf ("invalid label value (must be lowercase): objective=%q" , v )
107- }
108-
109- return nil
110- }
0 commit comments