From 08893bea4bfbe152f1b3a9f808b3fd454a9422a6 Mon Sep 17 00:00:00 2001 From: Jennifer Chang Date: Thu, 14 Mar 2024 09:19:22 -0400 Subject: [PATCH] fixup: conform to pathogen-repo-guide Match the upload rules in https://github.com/nextstrain/pathogen-repo-guide/pull/36 --- .../nextstrain-automation/upload.smk | 44 ++++++------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/ingest/build-configs/nextstrain-automation/upload.smk b/ingest/build-configs/nextstrain-automation/upload.smk index 1c82699..26d1346 100644 --- a/ingest/build-configs/nextstrain-automation/upload.smk +++ b/ingest/build-configs/nextstrain-automation/upload.smk @@ -18,39 +18,11 @@ send_notifications = ( ) -def _get_upload_inputs(wildcards): - """ - If the file_to_upload has Slack notifications that depend on diffs with S3 files, - then we want the upload rule to run after the notification rule. - - This function is mostly to keep track of which flag files to expect for - the rules in `slack_notifications.smk`, so it only includes flag files if - `send_notifications` is True. - """ - inputs = { - "file_to_upload": config["files_to_upload"][ - wildcards.remote_file_name - ], - } - - if send_notifications: - flag_file = [] - - if file_to_upload == "data/genbank.ndjson": - flag_file = "data/notify/genbank-record-change.done" - elif file_to_upload == "results/metadata.tsv": - flag_file = "data/notify/metadata-diff.done" - - inputs["notify_flag_file"] = flag_file - - return inputs - - rule upload_to_s3: input: - unpack(_get_upload_inputs), + file_to_upload=lambda wildcards: config["files_to_upload"][wildcards.remote_file], output: - "data/upload/s3/{remote_file_name}.done", + "results/upload/{remote_file}.upload", params: quiet="" if send_notifications else "--quiet", s3_dst=config["s3_dst"], @@ -60,6 +32,16 @@ rule upload_to_s3: ./vendored/upload-to-s3 \ {params.quiet} \ {input.file_to_upload:q} \ - {params.s3_dst:q}/{wildcards.remote_file_name:q} \ + {params.s3_dst:q}/{wildcards.remote_file:q} \ {params.cloudfront_domain} 2>&1 | tee {output} """ + + +rule upload_all: + input: + uploads=[ + f"results/upload/{remote_file}.upload" + for remote_file in config["files_to_upload"].keys() + ], + output: + touch("results/upload_all.done") \ No newline at end of file