check disc space
David M. Wilson
dw-google.com at botanicus.net
Thu Dec 11 06:17:00 EST 2003
More information about the Python-list mailing list
Thu Dec 11 06:17:00 EST 2003
- Previous message (by thread): check disc space
- Next message (by thread): check disc space
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Fredrik Lundh" <fredrik at pythonware.com> wrote... > - the os module is traditionally used to provide access to posix-style > services provided by the OS (or the C library). in this case, os.statvfs > is such a function; calling out to "du" isn't > (shouldn't that be "df", btw? os.popen("du -k dir").split()[-5] sure > doesn't give the free diskspace on any platform I have access to...) Um, yep. Fixed. *sheepish shrug* > (a third argument is that "free disc space" is a rather meaningless metric > on a modern operating system; it's hardly ever useful for anything except > "warning, warning, less than 5% free space" alerts. Considering what I see python used for on a day-to-day basis, this isn't "hardly ever useful". I have seen jobs fail as a direct result of no disk space check. This should indeed be handled elsewhere and in a different fashion, but sometimes the world just ain't the ideal place you'd like to believe it is. When you are performing 4gb deduplication runs on a cluster, and have to wait a couple of days only to find out you don't have enough disk space to write out the last 5 records of the result tables, I think this silly little module can be justified. And why not just use the POSIXy interface provided by os? Well, the company I work for uses the same codebase for both Windows and Linux clustering, which is a quite a feat. All support tools as such must run under both operating systems too. > you really don't want > people to write "if os.getfreespace() >= len(buffer): f.write(buffer)" and > file a bug when write fails ;-) Certainly not! :) But "if estimated_space > int(free_space * 1.05): ..." might not be such a bad thing when there is no other route to sanity available. Thanks, David.
- Previous message (by thread): check disc space
- Next message (by thread): check disc space
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list