From fd4033205a62174cfaf65154e58b1763be05bfed Mon Sep 17 00:00:00 2001 From: Nils Giordano Date: Fri, 21 May 2021 17:06:36 +0200 Subject: [PATCH] Fix #300 by sorting output targets before uploading --- awsf3/utils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/awsf3/utils.py b/awsf3/utils.py index 2daa4cd2..0f10f4ed 100644 --- a/awsf3/utils.py +++ b/awsf3/utils.py @@ -379,6 +379,16 @@ def upload_to_output_target(prj_out, encrypt_s3_upload=False): output_argnames = prj_out.output_files.keys() output_target = prj_out.alt_output_target(output_argnames) + # sorting outputs by mtime in order to upload in the right order. + # arbitrary order created issues with workflow managers (snakemake) + # because S3 does not save the modification time of uploaded objects + output_target = dict( + sorted( + output_target.items(), + key=lambda i: os.path.getmtime(i[0].replace('file://', '')) + ) + ) + for k in output_target: target = Target(output_bucket)