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

Side by Side Diff: appengine/cmd/milo/swarming/build.go

Issue 2141013003: milo: fix build/step timing (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: retrain Created 4 years, 5 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 | « appengine/cmd/milo/settings/funcs_test.go ('k') | appengine/cmd/milo/swarming/build_test.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The LUCI Authors. All rights reserved. 1 // Copyright 2015 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 "bytes" 8 "bytes"
9 "encoding/json" 9 "encoding/json"
10 "fmt" 10 "fmt"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 } 246 }
247 247
248 var err error 248 var err error
249 if sr.StartedTs != "" { 249 if sr.StartedTs != "" {
250 build.Summary.Started, err = time.Parse(SwarmingTimeLayout, sr.S tartedTs) 250 build.Summary.Started, err = time.Parse(SwarmingTimeLayout, sr.S tartedTs)
251 if err != nil { 251 if err != nil {
252 return nil, fmt.Errorf("invalid task StartedTs: %s", err ) 252 return nil, fmt.Errorf("invalid task StartedTs: %s", err )
253 } 253 }
254 } 254 }
255 if sr.CompletedTs != "" { 255 if sr.CompletedTs != "" {
256 » » build.Summary.Finished, err = time.Parse(SwarmingTimeLayout, sr. StartedTs) 256 » » build.Summary.Finished, err = time.Parse(SwarmingTimeLayout, sr. CompletedTs)
257 if err != nil { 257 if err != nil {
258 return nil, fmt.Errorf("invalid task CompletedTs: %s", e rr) 258 return nil, fmt.Errorf("invalid task CompletedTs: %s", e rr)
259 } 259 }
260 } 260 }
261 if sr.Duration != 0 { 261 if sr.Duration != 0 {
262 build.Summary.Duration = time.Duration(sr.Duration * float64(tim e.Second)) 262 build.Summary.Duration = time.Duration(sr.Duration * float64(tim e.Second))
263 } else if sr.State == TaskRunning { 263 } else if sr.State == TaskRunning {
264 now := clock.Now(c) 264 now := clock.Now(c)
265 if build.Summary.Started.Before(now) { 265 if build.Summary.Started.Before(now) {
266 build.Summary.Duration = now.Sub(build.Summary.Started) 266 build.Summary.Duration = now.Sub(build.Summary.Started)
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 // Supports server aliases. 346 // Supports server aliases.
347 func taskPageURL(swarmingHostname, taskID string) string { 347 func taskPageURL(swarmingHostname, taskID string) string {
348 return fmt.Sprintf("https://%s/user/task/%s", swarmingHostname, taskID) 348 return fmt.Sprintf("https://%s/user/task/%s", swarmingHostname, taskID)
349 } 349 }
350 350
351 // botPageURL returns a URL to a human-consumable page of a swarming bot. 351 // botPageURL returns a URL to a human-consumable page of a swarming bot.
352 // Supports server aliases. 352 // Supports server aliases.
353 func botPageURL(swarmingHostname, botID string) string { 353 func botPageURL(swarmingHostname, botID string) string {
354 return fmt.Sprintf("https://%s/restricted/bot/%s", swarmingHostname, bot ID) 354 return fmt.Sprintf("https://%s/restricted/bot/%s", swarmingHostname, bot ID)
355 } 355 }
OLDNEW
« no previous file with comments | « appengine/cmd/milo/settings/funcs_test.go ('k') | appengine/cmd/milo/swarming/build_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698