Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Race condition between iterator and generators #55

Merged
merged 1 commit into from
May 27, 2024

Conversation

ddeboer
Copy link
Member

@ddeboer ddeboer commented May 26, 2024

Fix #45
Fix #53

@ddeboer ddeboer requested a review from mightymax May 26, 2024 18:38
@ddeboer ddeboer force-pushed the fix-race-condition branch from 9d6098e to 9b39b64 Compare May 26, 2024 18:53
@@ -107,7 +107,7 @@ describe('Generator Class', () => {
await pipelineParallelGenerators.run()
const file = fs.readFileSync(filePath, {encoding: 'utf-8'})
const fileLines = file.split('\n').sort()
expect(fileLines.length).to.equal(873)
expect(fileLines.length).to.equal(741)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is lower because of the duplicate triples that were being generated.

Copy link
Collaborator

@mightymax mightymax May 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't seem to find where the duplicate triples issue is solved. Apparently you did (great!) but can you link me to the line(s)? I just want to make sure we do not introduce a OoM issue.

Copy link
Collaborator

@mightymax mightymax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks David! Great that you where able to solve this!

@mightymax mightymax merged commit 0c7d07d into main May 27, 2024
2 checks passed
@mightymax mightymax deleted the fix-race-condition branch May 27, 2024 06:23
Copy link

🎉 This PR is included in version 1.0.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

}

private get batchSize(): number {
return this.stage.configuration.generator[this.index].batchSize ?? DEFAULT_BATCH_SIZE
}


public run($this?: NamedNode, batchSize?: number): void {
if ($this !== undefined) this.$thisList.push($this)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here the URIs are added to the same this.$thisList property again, causing duplicates.over.

src/lib/Generator.class.ts Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

running against a local data file create multiple identical results Inconsistent number of results
2 participants