Example #1
0
// See ingestion.Processor interface.
func (g *goldProcessor) Process(resultsFile ingestion.ResultFileLocation) error {
	r, err := resultsFile.Open()
	if err != nil {
		return err
	}

	dmResults, err := parseDMResultsFromReader(r)
	if err != nil {
		return err
	}

	commit, err := g.vcs.Details(dmResults.GitHash)
	if err != nil {
		return err
	}

	if !commit.Branches["master"] {
		return fmt.Errorf("Commit %s is not in master branch.", commit.Hash)
	}

	// Add the column to the trace db.
	cid, err := g.extractID(commit, dmResults)
	if err != nil {
		return err
	}

	return g.traceDB.Add(cid, dmResults.getTraceDBEntries())
}
// See ingestion.Processor interface.
func (p *perfProcessor) Process(resultsFile ingestion.ResultFileLocation) error {
	r, err := resultsFile.Open()
	if err != nil {
		return err
	}

	benchData, err := parseBenchDataFromReader(r)
	if err != nil {
		return err
	}

	commit, err := p.vcs.Details(benchData.Hash, true)
	if err != nil {
		return err
	}

	if !commit.Branches["master"] {
		return fmt.Errorf("Commit %s is not in master branch.", commit.Hash)
	}

	cid := &tracedb.CommitID{
		Timestamp: commit.Timestamp.Unix(),
		ID:        commit.Hash,
		Source:    "master",
	}

	// Add the column to the trace db.
	return p.traceDB.Add(cid, benchData.getTraceDBEntries())
}
// See ingestion.Processor interface.
func (p *pdfProcessor) Process(resultsFile ingestion.ResultFileLocation) error {
	r, err := resultsFile.Open()
	if err != nil {
		return err
	}

	dmResults, err := goldingestion.ParseDMResultsFromReader(r)
	if err != nil {
		return err
	}

	// Get the results in this file that have produced a PDF.
	pdfResults := getPDFResults(dmResults)

	// If there are no PDF results we are done here.
	if len(pdfResults) == 0 {
		return nil
	}

	// Get the output name.
	outFile := resultsFile.Name()

	// check if they have been generated already (the JSON file exists)
	if p.resultExists(p.outJsonBucket, p.outJsonDir, outFile) {
		return nil
	}

	return p.rasterizeAndUpload(outFile, dmResults, pdfResults)
}
Example #4
0
// See ingestion.Processor interface.
func (p *perfTrybotProcessor) Process(resultsFile ingestion.ResultFileLocation) error {
	r, err := resultsFile.Open()
	if err != nil {
		return err
	}
	benchData, err := parseBenchDataFromReader(r)
	if err != nil {
		return err
	}
	issue, err := strconv.Atoi(benchData.Issue)
	if err != nil {
		return fmt.Errorf("Failed to parse trybot issue id: %s", err)
	}
	patchset, err := strconv.Atoi(benchData.PatchSet)
	if err != nil {
		return fmt.Errorf("Failed to parse trybot patch id: %s", err)
	}
	var ts time.Time
	var ok bool
	var cacheId = benchData.Issue + ":" + benchData.PatchSet
	if ts, ok = p.cache[cacheId]; !ok {
		patchinfo, err := p.review.GetPatchset(int64(issue), int64(patchset))
		if err != nil {
			return fmt.Errorf("Failed to retrieve trybot patch info: %s", err)
		}
		ts = patchinfo.Created
		// p.cache is a very crude LRU cache.
		if len(p.cache) > TIMESTAMP_LRU_CACHE_SIZE {
			p.cache = map[string]time.Time{}
		}
		p.cache[cacheId] = ts
	}
	source := fmt.Sprintf("%s/%d", CODE_REVIEW_URL, issue)

	cid := &tracedb.CommitID{
		Timestamp: ts,
		ID:        benchData.PatchSet,
		Source:    source,
	}

	// Add the column to the trace db.
	return p.traceDB.Add(cid, benchData.getTraceDBEntries())
}