Skip to content

Commit

Permalink
Merge pull request #1813 from souravsingh/add-code
Browse files Browse the repository at this point in the history
Adjust print statement in check_space
  • Loading branch information
standage committed Dec 4, 2017
2 parents 2441a99 + 209e7ca commit 586e79c
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions khmer/kfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,19 @@ def check_space(in_files, force, _testhook_free_space=None):

size_diff = total_size - free_space
if size_diff > 0:
print("ERROR: Not enough free space on disk "
"for output files;\n"
" Need at least %.1f GB more."
% (float(size_diff) / 1e9), file=sys.stderr)
print(" Estimated output size: %.1f GB"
% (float(total_size) / 1e9,), file=sys.stderr)
print(" Free space: %.1f GB"
% (float(free_space) / 1e9,), file=sys.stderr)
if not force:
print("NOTE: This can be overridden using the --force argument",
file=sys.stderr)
sys.exit(1)
mem_needed = '{:.1f} GB'.format(size_diff / 1e9)
mem_requested = '{:.1f} GB'.format(total_size / 1e9)
mem_available = '{:.1f} GB'.format(free_space / 1e9)
message = 'Not enough free space on disk for output files;'
message += '\n Need at least {:s} more.'.format(mem_needed)
message += '\n Estimated Output size: {:s}'.format(mem_requested)
message += '\n Free space: {:s}'.format(mem_available)
if force:
print('WARNING:', message, file=sys.stderr)
else:
message = 'ERROR: ' + message + \
'\nNOTE: This can be overridden using the --force argument'
raise SystemExit(message)


def check_space_for_graph(outfile_name, hash_size, force,
Expand Down

0 comments on commit 586e79c

Please sign in to comment.