diff --git a/.github/workflows/run-nextflu-private-builds.yaml b/.github/workflows/run-nextflu-private-builds.yaml index 772e68d4..07be8982 100644 --- a/.github/workflows/run-nextflu-private-builds.yaml +++ b/.github/workflows/run-nextflu-private-builds.yaml @@ -25,8 +25,10 @@ jobs: --memory 72gib \ --env AWS_ACCESS_KEY_ID \ --env AWS_SECRET_ACCESS_KEY \ + --env NEXTSTRAIN_USERNAME \ + --env NEXTSTRAIN_PASSWORD \ . \ - all \ + deploy_all \ all_counts_of_recent_tips_by_clade \ -p \ --configfile profiles/nextflu-private.yaml diff --git a/Snakefile b/Snakefile index 2c1c69f1..5ee0aec9 100644 --- a/Snakefile +++ b/Snakefile @@ -37,10 +37,6 @@ include: "workflow/snakemake_rules/fitness.smk" include: "workflow/snakemake_rules/report.smk" -if "custom_rules" in config: - for rule_file in config["custom_rules"]: - include: rule_file - def _get_build_outputs(): outputs = [] for build_name, build_params in config["builds"].items(): @@ -60,6 +56,10 @@ def _get_build_outputs(): return outputs +if "custom_rules" in config: + for rule_file in config["custom_rules"]: + include: rule_file + rule all: input: _get_build_outputs() diff --git a/profiles/nextflu-private.yaml b/profiles/nextflu-private.yaml index fae9cb75..001e1df2 100644 --- a/profiles/nextflu-private.yaml +++ b/profiles/nextflu-private.yaml @@ -2,6 +2,10 @@ custom_rules: - workflow/snakemake_rules/download_from_s3.smk - profiles/nextflu-private/antigenic_distances.smk - profiles/nextflu-private/report.smk + - profiles/nextflu-private/deploy.smk + +# URL for auto-deploying builds +deploy_url: https://nextstrain.org/groups/nextflu-private/ fasta_fields: - strain diff --git a/profiles/nextflu-private/README.md b/profiles/nextflu-private/README.md index 9b06cc66..2772c948 100644 --- a/profiles/nextflu-private/README.md +++ b/profiles/nextflu-private/README.md @@ -1,28 +1,10 @@ # Monthly reports on seasonal influenza evolution -## Build trees +## Build and deploy trees -[Run the nextflu-private build with the GitHub Action](https://github.com/nextstrain/seasonal-flu/actions/workflows/run-nextflu-private-builds.yaml). -Use the build summary for the job to track the progress of the builds on AWS Batch and download the final builds. -If trees look reasonable, rename them to match the current date (or the date corresponding to when the data were updated). - -``` bash -export DATE=2022-10-03 -cd auspice/ - -for file in {h1n1pdm,h3n2,vic}* -do - mv ${file} "flu_seasonal_${DATE}_${file}" -done -``` - -Upload the files to the Nextstrain group. - -``` bash -nextstrain remote upload \ - https://nextstrain.org/groups/nextflu-private/ \ - *.json -``` +[Run the nextflu-private builds with the GitHub Action](https://github.com/nextstrain/seasonal-flu/actions/workflows/run-nextflu-private-builds.yaml). +The workflow automatically deploys dated Auspice JSONs to [the nextflu-private group](https://nextstrain.org/groups/nextflu-private/) (e.g., https://nextstrain.org/groups/nextflu-private/flu/seasonal/2024-01-08/h3n2/2y/ha). +View the GitHub Action summary for details about how to download the build artifacts from AWS Batch. ## Prepare a report diff --git a/profiles/nextflu-private/deploy.smk b/profiles/nextflu-private/deploy.smk new file mode 100644 index 00000000..ee2fbc0a --- /dev/null +++ b/profiles/nextflu-private/deploy.smk @@ -0,0 +1,30 @@ +""" +This part of the workflow handles automatic deployments of nextflu-private builds. +""" + +rule all_private: + input: + jsons=_get_build_outputs(), + output: + json_dir=directory("auspice_renamed"), + params: + build_date=datetime.date.today().strftime("%Y-%m-%d"), + shell: + """ + mkdir -p {output.json_dir}; + for file in {input.jsons} + do + ln ${{file}} {output.json_dir}/"flu_seasonal_{params.build_date}_`basename ${{file}}`" + done + """ + +rule deploy_all: + input: + json_dir=directory("auspice_renamed"), + params: + deploy_url = config["deploy_url"] + shell: + """ + nextstrain login --no-prompt; + nextstrain remote upload {params.deploy_url} {input.json_dir}/*.json + """