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

Usee POSIX atomic file install instead of copying from TMPDIR #5

Open
diekhans opened this issue Feb 18, 2023 · 0 comments
Open

Usee POSIX atomic file install instead of copying from TMPDIR #5

diekhans opened this issue Feb 18, 2023 · 0 comments

Comments

@diekhans
Copy link

LyRic would be faster and more robust if it used POSIX atomic file creation instead of writing to TMPDIR and then
copying in place.

TMPDIR is usually on a separate file system, so

mv {TMPDIR}/$uuidTmpOut {output.bam}

Would usually be a copy. If there is an error, such as out of disk space, an incomplete output file
out exist.

If the file is created on the same file system as the output file, so the mv is an atomic rename.
In bash I would do:

tmpout=${outbam}.tmp
do_something  > ${tmpout}
mv -f ${tmpout} ${outbam}

Assuming bash is run with -e, the completed file doesn't exist under
the final name until it is successfully completed, and there is no copy overhead.

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

No branches or pull requests

1 participant