Skip to content

feat: deploy builds eagerly, not wait until all done#1025

Merged
corneliusroemer merged 1 commit intomasterfrom
eager-deploy
Nov 3, 2022
Merged

feat: deploy builds eagerly, not wait until all done#1025
corneliusroemer merged 1 commit intomasterfrom
eager-deploy

Conversation

@corneliusroemer
Copy link
Copy Markdown
Member

@corneliusroemer corneliusroemer commented Nov 1, 2022

Description of proposed changes

Currently we only deploy builds once all builds are done.

Especially when testing, this causes unnecessarily large delays: some builds can be done as soon as 1.5hr after a build is started, but others may take 12hr.

This PR adds an intermediate rule that deploys a single build as soon as all files are ready. This was discussed briefly on Slack and @trvrb gave green light for this change: https://bedfordlab.slack.com/archives/CSKMU6YUC/p1666885515151009

Changes are minimal, I tested this using dry run, will make a test run, this should work well and help test things faster in the future.

To make it easier to check builds that have finished, I've added Slack messages including the URL for each successful deployment. We already output a lot of files anyways and having clickable URLs is quite useful.

Testing

Test builds:

nextstrain build --aws-batch --no-download --attach 484fdc4c-4465-4f99-a791-6d991bfcee17 .
nextstrain build --aws-batch --no-download --attach 30b12b38-16e1-4f92-b7e3-761b282c8c14 .

https://nextstrain.org/staging/ncov/gisaid/trial/eager/global/all-time
https://nextstrain.org/staging/ncov/open/trial/eager/global/all-time

The first build was already deployed after less than 90min (reference, open)

Copy link
Copy Markdown
Member

@victorlin victorlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know enough about Snakemake to give a hard approval, but looks like you've tested successfully so consider this a soft approval. I just have a few non-blocking comments.

rule deploy:
input:
*rules.all_regions.input
expand("auspice/{build_name}.deployed", build_name=BUILD_NAMES),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this work? There is a separate deploy for every item in BUILD_NAMES?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rule deploy is the one that requests deployment of all builds.

Previously it asked for all files, and then deployed them itself.

Now it asks for a touchfile auspice/{build_name}.deployed instead, which causes the rule deploy_single to deploy one build at a time.

The speed up happens because previously deploy only happened once all input files = all builds were ready.

Now the actual deployments can happen as soon as all build files for a single build are done.

Copy link
Copy Markdown
Contributor

@tsibley tsibley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good by inspection to me.

The branch history is one primary commit and then four fixup commits + a changelog update commit. Would be nice to rebase those fixups away into the first commit before merging.

@corneliusroemer
Copy link
Copy Markdown
Member Author

I'll rebase - never done this before so bear with me 🙃

@victorlin
Copy link
Copy Markdown
Member

victorlin commented Nov 3, 2022

Looks like there's a small changelog conflict too, so you'll have to update with latest master to resolve the conflict.

Something like this should do it:

# Update your local master branch
git fetch origin master:master

# Switch to the working branch if you're not there already
git switch eager-deploy

# This will open a rebase prompt, and you can mark fixup commits accordingly.
git rebase -i master

# Resolve merge conflicts (note the date format consistency fix in changelog)

git push --force-with-lease

Currently we only deploy builds once all builds are done.

Especially when testing, this causes unnecessarily large delays: some builds can be done as soon as 1.5hr after a build is started, but others may take 12hr.

This PR adds an intermediate rule that deploys a single build as soon as all files are ready. This was discussed briefly on Slack and @trvrb gave green light for this change: https://bedfordlab.slack.com/archives/CSKMU6YUC/p1666885515151009

Changes are minimal, I tested this using dry run, will make a test run, this should work well and help test things faster in the future.

To make it easier to check builds that have finished, I've added Slack messages including the URL for each successful deployment. We already output a lot of files anyways and having clickable URLs is quite useful.

The rule deploy is the one that requests deployment of all builds.

Previously it asked for all files, and then deployed them itself.

Now it asks for a touchfile auspice/{build_name}.deployed instead, which causes the rule deploy_single to deploy one build at a time.

The speed up happens because previously deploy only happened once all input files = all builds were ready.

Now the actual deployments can happen as soon as all build files for a single build are done.
@corneliusroemer corneliusroemer merged commit 3cb92a1 into master Nov 3, 2022
@corneliusroemer corneliusroemer deleted the eager-deploy branch November 3, 2022 22:35
@corneliusroemer
Copy link
Copy Markdown
Member Author

Thanks @victorlin - I used fork in the end, hope it's good now. Looks good to me at least :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

3 participants