Skip to content

Commit

Permalink
Fix stat messages after file merigng in root contrib.
Browse files Browse the repository at this point in the history
  • Loading branch information
riga committed Jan 1, 2023
1 parent f13d6a5 commit d9bc203
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions law/contrib/root/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,13 @@ def hadd_cmd(input_paths, output_path):
if code != 0:
raise Exception("hadd failed")

task.publish_message("merged file size: {}".format(human_bytes(
output.stat().st_size, fmt=True)))
stat = output.exists(stat=True)
if not stat:
raise Exception("output '{}' not creating during merging".format(output.path))

# print the size
output_size = human_bytes(stat.st_size, fmt=True)
task.publish_message("merged file size: {}".format(output_size))

else:
# when not local, we need to fetch files first into the cwd
Expand All @@ -132,5 +137,10 @@ def callback(i):
if code != 0:
raise Exception("hadd failed")

task.publish_message("merged file size: {}".format(human_bytes(
tmp_out.stat().st_size, fmt=True)))
stat = tmp_out.exists(stat=True)
if not stat:
raise Exception("output '{}' not creating during merging".format(tmp_out.path))

# print the size
output_size = human_bytes(stat.st_size, fmt=True)
task.publish_message("merged file size: {}".format(output_size))

0 comments on commit d9bc203

Please sign in to comment.