Skip to content

Write intermediate intensity files atomically - #65

Open
moellep wants to merge 1 commit into
ochubar:masterfrom
radiasoft:fix-bkp-overwrite
Open

moellep wants to merge 1 commit into
ochubar:masterfrom
radiasoft:fix-bkp-overwrite

Conversation

@moellep

@moellep moellep commented Oct 1, 2026

Copy link
Copy Markdown

Readers polling an intermediate result file (e.g. a GUI) can see it truncated, because the ASCII and HDF5 writers open the destination with 'w' and write in place. For large results the write takes many seconds.

Both writers now write to a temporary file (the target path plus .tmp) and then os.replace() it into place. os.replace() is atomic, so a reader sees either the previous complete file or the new one. This makes the .bkp alternation in srwl_wfr_emit_prop_multi_e unnecessary, so it is removed. _file_bkp and _fbk are still accepted but ignored.

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.

1 participant