Skip to content

Commit 6cb036c

Browse files
author
Nils Giordano
committed
Fix #300 by sorting output targets before uploading
1 parent 6e017e7 commit 6cb036c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

awsf3/utils.py

+10
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,16 @@ def upload_to_output_target(prj_out, encrypt_s3_upload=False, kms_key_id=None, e
392392
output_argnames = prj_out.output_files.keys()
393393
output_target = prj_out.alt_output_target(output_argnames)
394394

395+
# sorting outputs by mtime in order to upload in the right order.
396+
# arbitrary order created issues with workflow managers (snakemake)
397+
# because S3 does not save the modification time of uploaded objects
398+
output_target = dict(
399+
sorted(
400+
output_target.items(),
401+
key=lambda i: os.path.getmtime(i[0].replace('file://', ''))
402+
)
403+
)
404+
395405
for k in output_target:
396406
target = Target(output_bucket)
397407

0 commit comments

Comments
 (0)