before big changes

This commit is contained in:
2022-02-18 22:53:09 +01:00
parent 37ce3536e1
commit 9737f97084
15 changed files with 234 additions and 91 deletions

View File

@ -8,7 +8,7 @@ import (
)
func ISequenceChunk(iterator obiseq.IBioSequenceBatch,
classifier obiseq.BioSequenceClassifier,
classifier *obiseq.BioSequenceClassifier,
sizes ...int) (obiseq.IBioSequenceBatch, error) {
bufferSize := iterator.BufferSize()
@ -32,27 +32,28 @@ func ISequenceChunk(iterator obiseq.IBioSequenceBatch,
dispatcher := iterator.Distribute(classifier)
jobDone := sync.WaitGroup{}
chunks := make(map[string]*obiseq.BioSequenceSlice, 100)
chunks := make(map[int]*obiseq.BioSequenceSlice, 1000)
for newflux := range dispatcher.News() {
jobDone.Add(1)
go func(newflux string) {
go func(newflux int) {
data, err := dispatcher.Outputs(newflux)
if err != nil {
log.Fatalf("Cannot retreive the new chanel : %v", err)
}
chunk := make(obiseq.BioSequenceSlice, 0, 1000)
chunk := obiseq.GetBioSequenceSlicePtr()
lock.Lock()
chunks[newflux] = chunk
lock.Unlock()
for data.Next() {
b := data.Get()
chunk = append(chunk, b.Slice()...)
*chunk = append(*chunk, b.Slice()...)
b.Recycle()
}
lock.Lock()
chunks[newflux] = &chunk
lock.Unlock()
jobDone.Done()
}(newflux)
}