| OLD | NEW |
| 1 package main | 1 package main |
| 2 | 2 |
| 3 // ingest is the command line tool for pulling performance data from Google | 3 // ingest is the command line tool for pulling performance data from Google |
| 4 // Storage and putting in Tiles. See the code in go/ingester for details on how | 4 // Storage and putting in Tiles. See the code in go/ingester for details on how |
| 5 // ingestion is done. | 5 // ingestion is done. |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "flag" | 8 "flag" |
| 9 "net/http" | 9 "net/http" |
| 10 "strings" | 10 "strings" |
| 11 "time" | 11 "time" |
| 12 | 12 |
| 13 "github.com/golang/glog" | 13 "github.com/golang/glog" |
| 14 "skia.googlesource.com/buildbot.git/go/auth" | 14 "skia.googlesource.com/buildbot.git/go/auth" |
| 15 "skia.googlesource.com/buildbot.git/go/common" | 15 "skia.googlesource.com/buildbot.git/go/common" |
| 16 "skia.googlesource.com/buildbot.git/go/database" |
| 16 "skia.googlesource.com/buildbot.git/go/gitinfo" | 17 "skia.googlesource.com/buildbot.git/go/gitinfo" |
| 17 "skia.googlesource.com/buildbot.git/perf/go/config" | 18 "skia.googlesource.com/buildbot.git/perf/go/config" |
| 18 "skia.googlesource.com/buildbot.git/perf/go/db" | 19 "skia.googlesource.com/buildbot.git/perf/go/db" |
| 19 "skia.googlesource.com/buildbot.git/perf/go/goldingester" | 20 "skia.googlesource.com/buildbot.git/perf/go/goldingester" |
| 20 "skia.googlesource.com/buildbot.git/perf/go/ingester" | 21 "skia.googlesource.com/buildbot.git/perf/go/ingester" |
| 21 "skia.googlesource.com/buildbot.git/perf/go/trybot" | 22 "skia.googlesource.com/buildbot.git/perf/go/trybot" |
| 22 ) | 23 ) |
| 23 | 24 |
| 24 // flags | 25 // flags |
| 25 var ( | 26 var ( |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 go func() { | 67 go func() { |
| 67 oneStep() | 68 oneStep() |
| 68 for _ = range time.Tick(every) { | 69 for _ = range time.Tick(every) { |
| 69 oneStep() | 70 oneStep() |
| 70 } | 71 } |
| 71 }() | 72 }() |
| 72 } | 73 } |
| 73 } | 74 } |
| 74 | 75 |
| 75 func main() { | 76 func main() { |
| 77 // Setup DB flags. |
| 78 database.SetupFlags(db.PROD_DB_HOST, db.PROD_DB_PORT, database.USER_RW,
db.PROD_DB_NAME) |
| 79 |
| 76 common.InitWithMetrics("ingest", *graphiteServer) | 80 common.InitWithMetrics("ingest", *graphiteServer) |
| 77 | 81 |
| 78 // Initialize the database. We might not need the oauth dialog if it fai
ls. | 82 // Initialize the database. We might not need the oauth dialog if it fai
ls. |
| 79 » db.Init(db.ProdDatabaseConfig(*local)) | 83 » conf, err := database.ConfigFromFlagsAndMetadata(*local, db.MigrationSte
ps()) |
| 84 » if err != nil { |
| 85 » » glog.Fatal(err) |
| 86 » } |
| 87 » db.Init(conf) |
| 80 | 88 |
| 81 var client *http.Client | 89 var client *http.Client |
| 82 var err error | |
| 83 if *doOauth { | 90 if *doOauth { |
| 84 config := auth.DefaultOAuthConfig(*oauthCacheFile) | 91 config := auth.DefaultOAuthConfig(*oauthCacheFile) |
| 85 client, err = auth.RunFlow(config) | 92 client, err = auth.RunFlow(config) |
| 86 if err != nil { | 93 if err != nil { |
| 87 glog.Fatalf("Failed to auth: %s", err) | 94 glog.Fatalf("Failed to auth: %s", err) |
| 88 } | 95 } |
| 89 } else { | 96 } else { |
| 90 client = nil | 97 client = nil |
| 91 // Add back service account access here when it's fixed. | 98 // Add back service account access here when it's fixed. |
| 92 } | 99 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 112 glog.Infof("Process name: %s", name) | 119 glog.Infof("Process name: %s", name) |
| 113 if startProcess, ok := ingesters[name]; ok { | 120 if startProcess, ok := ingesters[name]; ok { |
| 114 startProcess() | 121 startProcess() |
| 115 } else { | 122 } else { |
| 116 glog.Fatalf("Not a valid ingester name: %s", name) | 123 glog.Fatalf("Not a valid ingester name: %s", name) |
| 117 } | 124 } |
| 118 } | 125 } |
| 119 | 126 |
| 120 select {} | 127 select {} |
| 121 } | 128 } |
| OLD | NEW |