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

fix: catch errors in remote.AUTO provider list #1834

Merged
merged 3 commits into from Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions snakemake/remote/__init__.py
Expand Up @@ -471,10 +471,14 @@ def protocol_mapping(self):
# assemble scheme mapping
protocol_dict = {}
for Provider in provider_list:
for protocol in Provider().available_protocols:
protocol_short = protocol[:-3] # remove "://" suffix
protocol_dict[protocol_short] = Provider

try:
for protocol in Provider().available_protocols:
protocol_short = protocol[:-3] # remove "://" suffix
protocol_dict[protocol_short] = Provider
except Exception as e:
# If for any reason Provider() fails (e.g. missing python
# packages or config env vars), skip this provider.
logger.debug(f"Instantiating {Provider.__class__.__name__} failed: {e}")
return protocol_dict

def remote(self, value, *args, provider_kws=None, **kwargs):
Expand Down
10 changes: 10 additions & 0 deletions tests/test_remote_auto/Snakefile
@@ -0,0 +1,10 @@
#import re, os, sys
shell.executable("bash")

from snakemake.remote import AUTO

rule all:
input:
AUTO.remote("https://github.com/snakemake/snakemake/raw/main/images/logo.png")
run:
shell("cp {input} ./")
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.