Exiting immediately is probably "safest".  It's unlikely to occur in a good
or pre-planned situation, and this way they don't continue with the
heavyweight computation which will then fail.

--t

On Sun, Jan 26, 2014 at 09:37:41AM -0800, Ram RS wrote:
> > +    # and assuming all inFiles are in same disk
> > +    dirPath = os.dirname(inFiles[0])
> > +    target=os.statvfs(dirPath)
> > +    freeSpace = target.f_bsize * target.f_bavail 
> > +    #<TODO>: If SU, use target.f_bfree
> > +    
> > +    # Get input file size as worst case estimate of 
> > +    # output file size
> > +    fileSizes = map(lambda f: os.stat(f).st_size, inFiles)
> > +    totalSize = reduce(lambda f1, f2: f1+f2, fileSizes)
> > +    
> > +    sizeDiff = totalSize-freeSpace
> > +    if sizeDiff > 0:
> > +        print >>sys.stderr, 'ERROR: Not enough free space on disk, \
> > +        need at least %s more,' % str(freeSpace)
> > +        sys.exit(-1)
> 
> Should we just warn and not necessarily exit on low space?
> 
> Could we do something like totalSize/freeSpace < 0.5 --> exit() else warn()?
> 
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/ged-lab/khmer/pull/270/files#r9176618
-- 
C. Titus Brown, ctb@msu.edu