| OLD | NEW |
| 1 // Copyright 2017 The LUCI Authors. All rights reserved. | 1 // Copyright 2017 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package swarming | 5 package swarming |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "strconv" | 8 "strconv" |
| 9 "strings" | 9 "strings" |
| 10 "unicode/utf8" | 10 "unicode/utf8" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 host := sf.getHost() | 58 host := sf.getHost() |
| 59 logging.Infof(c, "Loading build info for Swarming host %s, task %s.", ho
st, req.Task) | 59 logging.Infof(c, "Loading build info for Swarming host %s, task %s.", ho
st, req.Task) |
| 60 | 60 |
| 61 fetchParams := swarmingFetchParams{ | 61 fetchParams := swarmingFetchParams{ |
| 62 fetchReq: true, | 62 fetchReq: true, |
| 63 fetchRes: true, | 63 fetchRes: true, |
| 64 } | 64 } |
| 65 fr, err := swarmingFetch(c, sf, req.Task, fetchParams) | 65 fr, err := swarmingFetch(c, sf, req.Task, fetchParams) |
| 66 if err != nil { | 66 if err != nil { |
| 67 if err == errNotMiloJob { | 67 if err == errNotMiloJob { |
| 68 » » » logging.Warningf(c, "User requested non-Milo task.") | 68 » » » logging.Warningf(c, "User requested nonexistent task or
does not have permissions.") |
| 69 return nil, grpcutil.NotFound | 69 return nil, grpcutil.NotFound |
| 70 } | 70 } |
| 71 | 71 |
| 72 logging.WithError(err).Errorf(c, "Failed to load Swarming task."
) | 72 logging.WithError(err).Errorf(c, "Failed to load Swarming task."
) |
| 73 return nil, grpcutil.Internal | 73 return nil, grpcutil.Internal |
| 74 } | 74 } |
| 75 | 75 |
| 76 // Determine the LogDog annotation stream path for this Swarming task. | 76 // Determine the LogDog annotation stream path for this Swarming task. |
| 77 // | 77 // |
| 78 // On failure, will return a gRPC error. | 78 // On failure, will return a gRPC error. |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 lastChar, lastCharSize := utf8.DecodeLastRuneInString(taskID) | 267 lastChar, lastCharSize := utf8.DecodeLastRuneInString(taskID) |
| 268 v, err := strconv.ParseUint(string(lastChar), 16, 8) | 268 v, err := strconv.ParseUint(string(lastChar), 16, 8) |
| 269 if err != nil { | 269 if err != nil { |
| 270 return "", errors.Annotate(err).Reason("failed to parse hex from
rune: %(rune)r"). | 270 return "", errors.Annotate(err).Reason("failed to parse hex from
rune: %(rune)r"). |
| 271 D("rune", lastChar). | 271 D("rune", lastChar). |
| 272 Err() | 272 Err() |
| 273 } | 273 } |
| 274 | 274 |
| 275 return taskID[:len(taskID)-lastCharSize] + strconv.FormatUint((v|uint64(
tryNumber)), 16), nil | 275 return taskID[:len(taskID)-lastCharSize] + strconv.FormatUint((v|uint64(
tryNumber)), 16), nil |
| 276 } | 276 } |
| OLD | NEW |