Skip to content

Commit

Permalink
Add temporary test on LineMerger within production pipeline
Browse files Browse the repository at this point in the history
This is an experiment, trying to find the cause of this bug:
#40
  • Loading branch information
brawer committed May 17, 2024
1 parent 44b1f72 commit a58b70f
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions cmd/qrank-builder/itemsignals.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,33 @@ func buildItemSignals(ctx context.Context, pageviews []string, sites *map[string
scannerNames = append(scannerNames, pv)
}

// TODO: This is just hack to investigate a bug. Remove it.
// https://github.com/brawer/wikidata-qrank/issues/40
if true {
merg := NewLineMerger(scanners, scannerNames)
logger.Printf("BuildItemSignals(): start testing LineMerger")
var lastLine string
var numOrderErrors int64
var numLines int64
for merg.Advance() {
numLines += 1
line := merg.Line()
if lastLine >= line {
numOrderErrors += 1
if numOrderErrors < 10 {
logger.Printf(`LineMerger broken: "%s" after "%s"`, line, lastLine)
}
}
lastLine = line
}
if err := merg.Err(); err != nil {
logger.Printf("LineMerger failed: %v", err)
return time.Time{}, err
}
logger.Printf("BuildItemSignals(): finished testing LineMerger, returned %d lines, %d of which were mis-ordered", numLines, numOrderErrors)
return time.Time{}, nil
}

// Produce a stream of ItemSignals, sorted by Wikidata item ID.
sigChan := make(chan extsort.SortType, 10000)
config := extsort.DefaultConfig()
Expand Down

0 comments on commit a58b70f

Please sign in to comment.