You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are some similiar routines described in M_io and M_io.f90 and M_path.f90 in GPF. There are seperate routines for a true status='scratch' file and a unique scratchfile name; and a discussion of the pros and cons of how status='scratch' is implemented (there is a big variation in implementations) at wiki that brings up a few relevant points about how depending on status='scratch' has pitfalls because of bad implementations. I really like the idea of making a scratch directory, especially if it was cleaned up automatically like a scratch file should be; I do not have anything like that. The python implementation does not clean up at termination automatically.
I really like the idea of making a scratch directory, especially if it was cleaned up automatically like a scratch file should be; I do not have anything like that.
@urbanjost: I like this idea too. Would it be possible with derived types and a final procedure?
Yes, we should use a derived type with a finalizer for this. I updated the issue description with links to temporary files and directories implementation in Python, Rust and Julia.
Activity
epagone commentedon Jan 27, 2020
I might be missing something obvious, but why can't we just use
open(status='SCRATCH',...)
?certik commentedon Jan 27, 2020
We could. I haven't thought of that as an option.
urbanjost commentedon Jan 28, 2020
There are some similiar routines described in
M_io and M_io.f90 and M_path.f90 in GPF. There are seperate routines for a true status='scratch' file and a unique scratchfile name; and a discussion of the pros and cons of how status='scratch' is implemented (there is a big variation in implementations) at wiki that brings up a few relevant points about how depending on status='scratch' has pitfalls because of bad implementations. I really like the idea of making a scratch directory, especially if it was cleaned up automatically like a scratch file should be; I do not have anything like that. The python implementation does not clean up at termination automatically.
certik commentedon Jan 28, 2020
Python's
mkdtemp
does not clean up, but TemporaryDirectory does.jvdp1 commentedon Jan 28, 2020
@urbanjost: I like this idea too. Would it be possible with derived types and a
final
procedure?certik commentedon Jan 28, 2020
Yes, we should use a derived type with a finalizer for this. I updated the issue description with links to temporary files and directories implementation in Python, Rust and Julia.