| 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 "encoding/json" | 8 "encoding/json" |
| 9 "flag" | 9 "flag" |
| 10 "net/http" | 10 "net/http" |
| 11 "os" | 11 "os" |
| 12 "strings" | 12 "strings" |
| 13 "sync" | 13 "sync" |
| 14 "time" | 14 "time" |
| 15 | 15 |
| 16 "github.com/golang/glog" | 16 "github.com/golang/glog" |
| 17 "skia.googlesource.com/buildbot.git/go/auth" | 17 "skia.googlesource.com/buildbot.git/go/auth" |
| 18 "skia.googlesource.com/buildbot.git/go/common" | 18 "skia.googlesource.com/buildbot.git/go/common" |
| 19 "skia.googlesource.com/buildbot.git/go/database" |
| 19 "skia.googlesource.com/buildbot.git/go/gitinfo" | 20 "skia.googlesource.com/buildbot.git/go/gitinfo" |
| 20 "skia.googlesource.com/buildbot.git/perf/go/config" | 21 "skia.googlesource.com/buildbot.git/perf/go/config" |
| 21 "skia.googlesource.com/buildbot.git/perf/go/db" | 22 "skia.googlesource.com/buildbot.git/perf/go/db" |
| 22 "skia.googlesource.com/buildbot.git/perf/go/goldingester" | 23 "skia.googlesource.com/buildbot.git/perf/go/goldingester" |
| 23 "skia.googlesource.com/buildbot.git/perf/go/ingester" | 24 "skia.googlesource.com/buildbot.git/perf/go/ingester" |
| 24 "skia.googlesource.com/buildbot.git/perf/go/trybot" | 25 "skia.googlesource.com/buildbot.git/perf/go/trybot" |
| 25 ) | 26 ) |
| 26 | 27 |
| 27 // flags | 28 // flags |
| 28 var ( | 29 var ( |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 133 |
| 133 return func() { | 134 return func() { |
| 134 oneStep() | 135 oneStep() |
| 135 for _ = range time.Tick(every) { | 136 for _ = range time.Tick(every) { |
| 136 oneStep() | 137 oneStep() |
| 137 } | 138 } |
| 138 } | 139 } |
| 139 } | 140 } |
| 140 | 141 |
| 141 func main() { | 142 func main() { |
| 143 // Setup DB flags. |
| 144 database.SetupFlags(db.PROD_DB_HOST, db.PROD_DB_PORT, database.USER_RW,
db.PROD_DB_NAME) |
| 145 |
| 142 common.InitWithMetrics("ingest", *graphiteServer) | 146 common.InitWithMetrics("ingest", *graphiteServer) |
| 143 | 147 |
| 144 goldingester.Init(*fileCacheDir) | 148 goldingester.Init(*fileCacheDir) |
| 145 | 149 |
| 146 // Initialize the database. We might not need the oauth dialog if it fai
ls. | 150 // Initialize the database. We might not need the oauth dialog if it fai
ls. |
| 147 » db.Init(db.ProdDatabaseConfig(*local)) | 151 » conf, err := database.ConfigFromFlagsAndMetadata(*local, db.MigrationSte
ps()) |
| 152 » if err != nil { |
| 153 » » glog.Fatal(err) |
| 154 » } |
| 155 » db.Init(conf) |
| 148 | 156 |
| 149 var client *http.Client | 157 var client *http.Client |
| 150 var err error | |
| 151 if *doOauth { | 158 if *doOauth { |
| 152 config := auth.DefaultOAuthConfig(*oauthCacheFile) | 159 config := auth.DefaultOAuthConfig(*oauthCacheFile) |
| 153 client, err = auth.RunFlow(config) | 160 client, err = auth.RunFlow(config) |
| 154 if err != nil { | 161 if err != nil { |
| 155 glog.Fatalf("Failed to auth: %s", err) | 162 glog.Fatalf("Failed to auth: %s", err) |
| 156 } | 163 } |
| 157 } else { | 164 } else { |
| 158 client = nil | 165 client = nil |
| 159 // Add back service account access here when it's fixed. | 166 // Add back service account access here when it's fixed. |
| 160 } | 167 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 180 glog.Infof("Process name: %s", name) | 187 glog.Infof("Process name: %s", name) |
| 181 if process, ok := ingesters[name]; ok { | 188 if process, ok := ingesters[name]; ok { |
| 182 go process() | 189 go process() |
| 183 } else { | 190 } else { |
| 184 glog.Fatalf("Not a valid ingester name: %s", name) | 191 glog.Fatalf("Not a valid ingester name: %s", name) |
| 185 } | 192 } |
| 186 } | 193 } |
| 187 | 194 |
| 188 select {} | 195 select {} |
| 189 } | 196 } |
| OLD | NEW |