Open zatkins2 opened 8 months ago
Don't we want such attempts to fail with an error? It's the user's responsibility to make sure multiple processes don't write to the same file no? Maybe I'm missing the point of your recommendation. What is achieved exactly if the user can set overwrite to False?
Description
enmap.write_fits
ends with a call tohdus.writeto(fname, overwrite=True)
. In the case that multiple processes useenmap.write_fits
to write to the same file at the same time,hdus.writeto(fname, overwrite=True)
can crash because internally it does many operations on the file, including removing it from the filesystem. If one process removes the file while another tries to call some operation on the file, the second process will throw aFileNotFoundError
. This is more of an edge case, but I've encountered it a few times in embarrassingly parallel scripts that each e.g. write a mask to disk.I don't think it's really the responsibility of
pixell
to handle this particular bug, it's more an issue withastropy
. But I'm documenting it here in case others encounter it, and to propose one change topixell
: bubble-up theoverwrite
kwarg all the way through toenmap.write_map
so that users could set it to beFalse
.Example