Skip to content

Commit fd40332

Browse files
author
Nils Giordano
committed
Fix #300 by sorting output targets before uploading
1 parent 506afd8 commit fd40332

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
@@ -379,6 +379,16 @@ def upload_to_output_target(prj_out, encrypt_s3_upload=False):
379379
output_argnames = prj_out.output_files.keys()
380380
output_target = prj_out.alt_output_target(output_argnames)
381381

382+
# sorting outputs by mtime in order to upload in the right order.
383+
# arbitrary order created issues with workflow managers (snakemake)
384+
# because S3 does not save the modification time of uploaded objects
385+
output_target = dict(
386+
sorted(
387+
output_target.items(),
388+
key=lambda i: os.path.getmtime(i[0].replace('file://', ''))
389+
)
390+
)
391+
382392
for k in output_target:
383393
target = Target(output_bucket)
384394

0 commit comments

Comments
 (0)