Beispiel #1
0
// See the ingester.ResultIngester interface.
func (t *TrybotResultIngester) Ingest(_ *ingester.TileTracker, opener ingester.Opener, fileInfo *ingester.ResultsFileLocation, counter metrics.Counter) error {
	r, err := opener()
	if err != nil {
		return fmt.Errorf("Unable to open reader: %s", err)
	}
	dmResults, err := goldingester.ParseDMResultsFromReader(r)
	if err != nil {
		return err
	}

	if _, ok := t.resultsByIssue[dmResults.Issue]; !ok {
		t.resultsByIssue[dmResults.Issue] = NewTryBotResults()
	}

	// Add the entire file to our current knowledge about this issue.
	t.resultsByIssue[dmResults.Issue].update(dmResults.Key, dmResults.Patchset, dmResults.Results, fileInfo.LastUpdated)
	counter.Inc(1)
	glog.Infof("Finished processing file %s.", fileInfo.Name)
	return nil
}
Beispiel #2
0
// See the ingester.ResultIngester interface.
func (t *TrybotResultIngester) Ingest(_ *ingester.TileTracker, opener ingester.Opener, fileInfo *ingester.ResultsFileLocation, counter metrics.Counter) error {
	r, err := opener()
	if err != nil {
		return fmt.Errorf("Unable to open reader: %s", err)
	}
	dmResults, err := goldingester.ParseDMResultsFromReader(r)
	if err != nil {
		return err
	}

	dmResults.ForEach(func(key, value string, params map[string]string) {
		if _, ok := t.resultsByIssue[dmResults.Issue]; !ok {
			t.resultsByIssue[dmResults.Issue] = types.NewTryBotResults()
		}
		t.resultsByIssue[dmResults.Issue].Update(key, params[types.PRIMARY_KEY_FIELD], value, params, fileInfo.LastUpdated)
	})

	counter.Inc(1)
	glog.Infof("Finished processing file %s.", fileInfo.Name)
	return nil
}