Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneskoester committed Sep 8, 2023
1 parent 0146425 commit db84fb0
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
9 changes: 7 additions & 2 deletions snakemake/caching/hash.py
Expand Up @@ -11,6 +11,7 @@
from snakemake import script
from snakemake import wrapper
from snakemake.exceptions import WorkflowError
from snakemake.settings import DeploymentMethod

# ATTENTION: increase version number whenever the hashing algorithm below changes!
__version__ = "0.1"
Expand Down Expand Up @@ -114,9 +115,13 @@ def _get_provenance_hash(self, job: Job, cache_mode: str):

# Hash used containers or conda environments.
if cache_mode != "omit-software":
if workflow.deployment_settings.use_conda and job.conda_env:
if (
DeploymentMethod.CONDA in workflow.deployment_settings.deployment_method
and job.conda_env
):
if (
workflow.deployment_settings.use_singularity
DeploymentMethod.APPTAINER
in workflow.deployment_settings.deployment_method
and job.conda_env.container_img_url
):
h.update(job.conda_env.container_img_url.encode())
Expand Down
3 changes: 1 addition & 2 deletions snakemake/cli.py
Expand Up @@ -111,8 +111,7 @@ def parse_set_resource_scope(args):
if args is not None:
try:
return ResourceScopes(
parse_key_value_arg(entry, errmsg=err_msg)
for entry in args
parse_key_value_arg(entry, errmsg=err_msg) for entry in args
)
except ResourceScopesException as err:
invalid_resources = ", ".join(
Expand Down
4 changes: 4 additions & 0 deletions snakemake/settings.py
Expand Up @@ -298,6 +298,10 @@ class ResourceSettings(SettingsBase):
overwrite_resources: Mapping[str, Mapping[str, int]] = immutables.Map()
default_resources: Optional[DefaultResources] = None

def __post_init__(self):
if self.default_resources is None:
self.default_resources = DefaultResources(mode="bare")


@dataclass
class ConfigSettings(SettingsBase):
Expand Down
4 changes: 2 additions & 2 deletions snakemake/workflow.py
Expand Up @@ -723,11 +723,11 @@ def printrulegraph(self):
def printfilegraph(self):
self._prepare_dag(
forceall=self.dag_settings.forceall,
ignore_incomplete=self.execution_settings.ignore_incomplete,
ignore_incomplete=True,
lock_warn_only=True,
)
self._build_dag()
self.dag.filegraph_dot()
print(self.dag.filegraph_dot())

def printd3dag(self):
self._prepare_dag(
Expand Down
12 changes: 11 additions & 1 deletion tests/common.py
Expand Up @@ -170,6 +170,10 @@ def run(
max_threads=None,
overwrite_groups=dict(),
configfiles=list(),
overwrite_resources=dict(),
batch=None,
envvars=list(),
cache=None,
):
"""
Test the Snakefile in the path.
Expand Down Expand Up @@ -251,7 +255,9 @@ def run(
if cluster is not None:
executor = "cluster-generic"
plugin = ExecutorPluginRegistry().get_plugin(executor)
executor_settings = plugin.executor_settings_class(submit_cmd=cluster, status_cmd=cluster_status)
executor_settings = plugin.executor_settings_class(
submit_cmd=cluster, status_cmd=cluster_status
)
nodes = 3

success = True
Expand All @@ -273,6 +279,7 @@ def run(
if overwrite_resource_scopes is not None
else dict()
),
overwrite_resources=overwrite_resources,
resources=resources,
default_resources=default_resources,
max_threads=max_threads,
Expand All @@ -298,6 +305,7 @@ def run(
until=until,
omit_from=omit_from,
forcerun=forcerun,
batch=batch,
),
deployment_settings=settings.DeploymentSettings(
conda_frontend=conda_frontend,
Expand All @@ -319,10 +327,12 @@ def run(
cleanup_scripts=cleanup_scripts,
shadow_prefix=shadow_prefix,
retries=retries,
cache=cache,
),
remote_execution_settings=settings.RemoteExecutionSettings(
container_image=container_image,
seconds_between_status_checks=0,
envvars=envvars,
),
scheduling_settings=settings.SchedulingSettings(
ilp_solver=scheduler_ilp_solver,
Expand Down

0 comments on commit db84fb0

Please sign in to comment.