knowing when file is flushed to disk

daftspaniel at gmail.com daftspaniel at gmail.com
Wed Aug 9 16:55:13 EDT 2006


John Pote wrote:
> Is there some way from my Python script to know when the data is actually on
> the disk. BTW server OS is Linux. Presumably calling flush() and close() on
> the output file will initiate the disk write, but do they wait for the
> actual disk write or immediately return leaving the OS to do the write when
> it sees fit?

All you can do in Python (or similar) is call flush & close and hope
for the best :-)

There are many factors outwith the control of the language e.g.
* Library behaviour
* OS behaviour
* Hardware cache on the disk itself

That said, I've only found it an issue when a computer is under heavy
load.

Hope this helps,
Davy Mitchell

http://www.latedecember.com/sites/personal/davy/




More information about the Python-list mailing list