Skip to content

Commit

Permalink
exception added for df call failure in mcl_id_triples
Browse files Browse the repository at this point in the history
  • Loading branch information
brantp committed Dec 11, 2012
1 parent f4789e9 commit a59f339
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mcl_id_triples_by_blat.py
Expand Up @@ -7,7 +7,7 @@
'''

import os, sys, re
import os, sys, re, numpy
from config import SCRATCH as scratch

keep_blat = False
Expand All @@ -33,7 +33,11 @@ def space_free_on_volume(vol,unit='M',verbose=False):
from subprocess import Popen,PIPE
if verbose:
print >> sys.stderr, 'checking free space on volume %s ...' % vol,
free = int(Popen('df -P --sync -B %s %s' % (unit,vol), shell=True, stdout=PIPE).stdout.readlines()[-1].strip().split()[3].rstrip(unit))
try:
free = int(Popen('df -P --sync -B %s %s' % (unit,vol), shell=True, stdout=PIPE).stdout.readlines()[-1].strip().split()[3].rstrip(unit))
except:
print >> sys.stderr, 'free space check failed; proceeding. MONITOR AVAILABLE SPACE ON %s' % vol
free = numpy.inf
if verbose:
print >> sys.stderr, '%s %sB' % (free,unit)
return free
Expand Down

0 comments on commit a59f339

Please sign in to comment.