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

Fsync for file output #305

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

sven-oly
Copy link
Collaborator

@sven-oly sven-oly commented Sep 18, 2024

This make sure that the output is synchronized with parallel execution.

@sven-oly
Copy link
Collaborator Author

This is an easy one!

@@ -91,6 +91,7 @@ def main(args):
output_filename = os.path.join(test_data_path, 'test_data_validation_summary.json')
file_out = open(output_filename, mode='w', encoding='utf-8')
file_out.write(summary_data)
os.fsync(file_out)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here and below: follow instructions for os.fsync() to include the appropriate argument and additionally do os.flush() prior to the fsync, since you are getting a file object from os.open().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants