From 2d1b6eb5c7adf27029ad3f900b9e357c2e66e105 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Tue, 21 Sep 2021 09:59:03 -0400 Subject: [PATCH] Log total variant/genome/ref counts. refs #17966 Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- slice.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/slice.go b/slice.go index 50f219fb3c..10e5e01bc2 100644 --- a/slice.go +++ b/slice.go @@ -16,6 +16,7 @@ import ( "runtime" "strings" "sync" + "sync/atomic" "git.arvados.org/arvados.git/sdk/go/arvados" "github.com/klauspost/pgzip" @@ -105,6 +106,10 @@ func Slice(dstdir, srcdir string, tagsPerFile int) error { bufws []*bufio.Writer gzws []*pgzip.Writer encs []*gob.Encoder + + countTileVariants int64 + countGenomes int64 + countReferences int64 ) throttle := throttle{Max: runtime.GOMAXPROCS(0)} @@ -145,6 +150,7 @@ func Slice(dstdir, srcdir string, tagsPerFile int) error { if err := throttle.Err(); err != nil { return err } + atomic.AddInt64(&countTileVariants, int64(len(ent.TileVariants))) for _, tv := range ent.TileVariants { err := encs[int(tv.Tag)/tagsPerFile].Encode(LibraryEntry{ TileVariants: []TileVariant{tv}, @@ -158,6 +164,7 @@ func Slice(dstdir, srcdir string, tagsPerFile int) error { // genome, even if there are no // variants in the relevant range. // Easier for downstream code. + atomic.AddInt64(&countGenomes, int64(len(ent.CompactGenomes))) for _, cg := range ent.CompactGenomes { for i, enc := range encs { start := i * tagsPerFile @@ -185,6 +192,7 @@ func Slice(dstdir, srcdir string, tagsPerFile int) error { } // Write all ref seqs to the first // slice. Easier for downstream code. + atomic.AddInt64(&countReferences, int64(len(ent.CompactSequences))) if len(ent.CompactSequences) > 0 { err := encs[0].Encode(LibraryEntry{CompactSequences: ent.CompactSequences}) if err != nil { @@ -201,6 +209,7 @@ func Slice(dstdir, srcdir string, tagsPerFile int) error { closeOutFiles(fs, bufws, gzws, encs) return throttle.Err() } + defer log.Printf("Total %d tile variants, %d genomes, %d reference sequences", countTileVariants, countGenomes, countReferences) return closeOutFiles(fs, bufws, gzws, encs) } -- 2.30.2