I am running Python with MPI on a supercomputing cluster. I am getting strange nondeterministic behavior that I think is a result of I/O complications that are not present on the single machines I'm used to working with.
One of the things my code does is to create directories using os.makedirs somewhat frequently. I know also that I generally should not write small amounts of data to the filesystem-- this can end up with the data getting stuck in some buffer and not written for a long time. I suspect this may be happening with my directory creation calls, and then later code tries to write to files inside the directory before it exists. Two questions:
- is creating a new directory effectively the same thing as writing a small amount of data?
- When forcing data to be written, I use
flushandos.fsync. These require a file object. Is there an equivalent to make sure the directory has been created?
while not os.path.isdir(target): # wait or retry?