diff --git a/snakemake/caching/hash.py b/snakemake/caching/hash.py index f9ec7ca1c..ded684e9f 100644 --- a/snakemake/caching/hash.py +++ b/snakemake/caching/hash.py @@ -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" @@ -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()) diff --git a/snakemake/cli.py b/snakemake/cli.py index 939eed8c6..d19f19921 100644 --- a/snakemake/cli.py +++ b/snakemake/cli.py @@ -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( diff --git a/snakemake/settings.py b/snakemake/settings.py index 9e9692f91..26baa8b35 100644 --- a/snakemake/settings.py +++ b/snakemake/settings.py @@ -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): diff --git a/snakemake/workflow.py b/snakemake/workflow.py index d8fc09c13..0a35a6d17 100644 --- a/snakemake/workflow.py +++ b/snakemake/workflow.py @@ -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( diff --git a/tests/common.py b/tests/common.py index f005af3be..9e90ea683 100644 --- a/tests/common.py +++ b/tests/common.py @@ -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. @@ -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 @@ -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, @@ -298,6 +305,7 @@ def run( until=until, omit_from=omit_from, forcerun=forcerun, + batch=batch, ), deployment_settings=settings.DeploymentSettings( conda_frontend=conda_frontend, @@ -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,