python-adaptive / adaptive

:chart_with_upwards_trend: Adaptive: parallel active learning of mathematical functions

Home Page:http://adaptive.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

learner.save creates file with different permissions than open().write

basnijholt opened this issue · comments

This is annoying when one uses a shared file system, where all other files that are written (with default settings) will be readable by other users but files that are saved with Adaptive are not.

In Adaptive this happens because of atomicwrites, code example:

from atomicwrites import AtomicWriter

with open("test_open", "w") as f:
    f.write("hi")

with AtomicWriter("test_adaptive", "wb", overwrite=True).open() as f:
    f.write(b"blob")

gives

$ ls -lah test*
-rw-------. 1 a-banijh a-banijh 4 Jun  2 08:33 test_adaptive
-rw-rw-r--. 1 a-banijh a-banijh 2 Jun  2 08:33 test_open

Maybe relevant:

Tagging @georgwinkler @jbweston