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

feat: Add more informative errors when evaluation of --default-resources fails #1192

Merged
Merged
Changes from 2 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
15 changes: 15 additions & 0 deletions snakemake/resources.py
@@ -1,6 +1,8 @@
import re
import tempfile

from snakemake.logging import logger


class DefaultResources:
defaults = {
Expand Down Expand Up @@ -58,6 +60,19 @@ def callable(wildcards, input, attempt, threads, rulename):
# Triggers for string arguments like n1-standard-4
except NameError:
return val
except Exception as e:
if not (
isinstance(e, FileNotFoundError) and e.filename in input
):
# Missing input files are handled by the caller
logger.error(
DonFreed marked this conversation as resolved.
Show resolved Hide resolved
"Error: Failed to evaluate DefaultResources "
"value '{}'.\n"
" String arguments may need additional "
"quoting. Ex: --default-resources "
"\"tmpdir='/home/user/tmp'\".".format(val)
)
raise e
return value

return callable
Expand Down