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

Side by Side Diff: perf/server/data.go

Issue 335183002: Fixing install and OAuth (Closed) Base URL: https://skia.googlesource.com/buildbot.git@master
Patch Set: rebase Created 6 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 | « no previous file | perf/server/perf.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 (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be found 2 // Use of this source code is governed by a BSD-style license that can be found
3 // in the LICENSE file. 3 // in the LICENSE file.
4 4
5 package main 5 package main
6 6
7 import ( 7 import (
8 "encoding/json" 8 "encoding/json"
9 "fmt" 9 "fmt"
10 "io" 10 "io"
11 "net/http" 11 "net/http"
12 "os/exec" 12 "os/exec"
13 "reflect" 13 "reflect"
14 "strconv" 14 "strconv"
15 "strings" 15 "strings"
16 "time" 16 "time"
17 ) 17 )
18 18
19 import ( 19 import (
20 "code.google.com/p/goauth2/compute/serviceaccount"
20 "code.google.com/p/goauth2/oauth" 21 "code.google.com/p/goauth2/oauth"
21 "code.google.com/p/google-api-go-client/bigquery/v2" 22 "code.google.com/p/google-api-go-client/bigquery/v2"
22 "github.com/oxtoacart/webbrowser" 23 "github.com/oxtoacart/webbrowser"
23 ) 24 )
24 25
25 const ( 26 const (
26 // JSON doesn't support NaN or +/- Inf, so we need a valid float 27 // JSON doesn't support NaN or +/- Inf, so we need a valid float
27 // to signal missing data that also has a compact JSON representation. 28 // to signal missing data that also has a compact JSON representation.
28 MISSING_DATA_SENTINEL = 1e100 29 MISSING_DATA_SENTINEL = 1e100
29 ) 30 )
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 // TODO(jcgregorio) Actuall do the bit where we start a go routine. 452 // TODO(jcgregorio) Actuall do the bit where we start a go routine.
452 func NewData(doOauth bool, gitRepoDir string) (*Data, error) { 453 func NewData(doOauth bool, gitRepoDir string) (*Data, error) {
453 var err error 454 var err error
454 var client *http.Client 455 var client *http.Client
455 if doOauth { 456 if doOauth {
456 client, err = runFlow(config) 457 client, err = runFlow(config)
457 if err != nil { 458 if err != nil {
458 return nil, fmt.Errorf("Failed to auth: %s", err) 459 return nil, fmt.Errorf("Failed to auth: %s", err)
459 } 460 }
460 } else { 461 } else {
461 » » client = http.DefaultClient 462 » » client, err = serviceaccount.NewClient(nil)
463 » » if err != nil {
464 » » » return nil, fmt.Errorf("Failed to auth using a service a ccount: %s", err)
465 » » }
462 } 466 }
463 service, err := bigquery.New(client) 467 service, err := bigquery.New(client)
464 if err != nil { 468 if err != nil {
465 return nil, fmt.Errorf("Failed to create a new BigQuery service object: %s", err) 469 return nil, fmt.Errorf("Failed to create a new BigQuery service object: %s", err)
466 } 470 }
467 471
468 // First query and get the list of hashes we are interested in and use t hat 472 // First query and get the list of hashes we are interested in and use t hat
469 // and the git log results to fill in the Commits. 473 // and the git log results to fill in the Commits.
470 allGitHashes, err := readCommitsFromGit(gitRepoDir) 474 allGitHashes, err := readCommitsFromGit(gitRepoDir)
471 if err != nil { 475 if err != nil {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 508
505 if err := populateTraces(service, all, hashToIndex, numSamples); err != nil { 509 if err := populateTraces(service, all, hashToIndex, numSamples); err != nil {
506 // Fail fast, monit will restart us if we fail for some reason. 510 // Fail fast, monit will restart us if we fail for some reason.
507 panic(err) 511 panic(err)
508 } 512 }
509 513
510 populateParamSet(all) 514 populateParamSet(all)
511 515
512 return &Data{all: all}, nil 516 return &Data{all: all}, nil
513 } 517 }
OLDNEW
« no previous file with comments | « no previous file | perf/server/perf.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698