Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce minimum augur version check #1070

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,30 @@ import time
# use of Bash's "strict mode", as we rely on that behaviour.
shell.prefix("set -euo pipefail; export AUGUR_RECURSION_LIMIT=10000; ")

# Check the installed version of augur matches the minimum for this workflow
minumim_supported_augur_version = "22.0.0"
try:
if not snakemake.workflow.workflow.use_conda:
from packaging import version # an explicit dependency of augur
from augur import version as augur_version
if version.parse(augur_version.__version__) < version.parse(minumim_supported_augur_version):
logger.error(textwrap.dedent(
f"\nYour version of augur ({augur_version.__version__}) needs to be upgraded to use this workflow." +
f"\nThe minimum augur version required is {minumim_supported_augur_version}." +
"\nPlease see https://docs.nextstrain.org/en/latest/guides/manage-installation.html for help with updating your installation." +
Copy link
Member Author

Choose a reason for hiding this comment

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

We could add "If you think this version check is not applicable for how you are running this workflow, you may remove it by setting config['skip_augur_version_check'] = true" here if we are worried (like I am) about not wanting to completely disable some rare (?) invocations of the workflow.

"\n"
))
raise SystemExit
else:
logger.debug("Not checking augur version as Snakemake is running within our conda environment")
except SystemExit:
sys.exit(1)
except:
# If snakemake internals change then we don't want the workflow to become unusable.
# Likewise, if we are running in an environment _without_ augur (and dependencies) installed
# then that may be ok in some situations?
logger.warning(f"Error while attempting to check augur version compat.\n{sys.exc_info()[0]}")

# Store the user's configuration prior to loading defaults, so we can check for
# reused subsampling scheme names in the user's config. We need to make a deep
# copy because Snakemake will deep merge the subsampling dictionary later,
Expand Down