Repository navigation
remote_files: Add support for directly using local cache - #87
Open
joverlee521 wants to merge 2 commits into
Open
joverlee521 wants to merge 2 commits into
joverlee521 wants to merge 2 commits into
Conversation
The Snakemake storage usually checks the existence and revalidates remote files before using the local cache, which can lead to errors when running the workflow offline even if the local cache already exists. This change adds support to directly use the local cache if it exists and bypass the remote file check when 1. the config parameter `use_remote_files` is False 2. the environment variable `NEXTSTRAIN_REMOTE_FILES` is False 3. the workflow is running offline Based on discussions in <nextstrain/public#47> and changes tested in measles repo <nextstrain/measles@60634e2...b238682>
This was referenced Oct 1, 2026
jameshadfield
left a comment
Member
There was a problem hiding this comment.
Thanks for taking this on and turning the prototype into a polished PR! I haven't tested the code but reading through it I think the behaviour is spot on. One minor query re: env variables is the only thing that stuck out to me.
Comment on lines
+17
to
+24
| def is_online(host="8.8.8.8", port=53, timeout=3) -> bool: | ||
| """ | ||
| Check if workflow has network connection. | ||
| Based on <https://stackoverflow.com/a/33117579> | ||
| Host: 8.8.8.8 (google-public-dns-a.google.com) | ||
| OpenPort: 53/tcp | ||
| Service: domain (DNS/TCP) | ||
| """ |
Member
There was a problem hiding this comment.
Cool! I like this general "is online" approach better than the per-source checks in my original prototype
Member
There was a problem hiding this comment.
On the other hand, by checking against Google, is_online could return True when sources are unavailable, or False when sources are available but Google is down. This is very edge case-y though, I think it's fine to keep as-is.
Based on discussion in review <#87 (comment)>
Contributor
Author
|
Will merge this next Tuesday to monitor downstream uses. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of proposed changes
The Snakemake storage usually checks the existence and revalidates remote files before using the local cache, which can lead to errors when running the workflow offline even if the local cache already exists.
This change adds support to directly use the local cache if it exists and bypass the remote file check when
use_remote_filesis FalseNEXTSTRAIN_REMOTE_FILESis FalseBased on discussions in nextstrain/public#47 and changes tested in measles repo
nextstrain/measles@60634e2...b238682
Related issue(s)
Part of nextstrain/public#47
Checklist
If adding a script, add an entry for it in the README.