Skip to content

Commit 6232764

Browse files
fix: better handling of allowed rules in combination with snakemake >=9.6.2 (#89)
1 parent d4fe083 commit 6232764

File tree

2 files changed

+31
-27
lines changed

2 files changed

+31
-27
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license = { text = "MIT" }
77
readme = "README.md"
88
requires-python = ">=3.11"
99
dependencies = [
10-
"snakemake-interface-common>=1.17.4",
10+
"snakemake-interface-common>=1.19.0",
1111
"throttler>=1.2.2",
1212
"argparse-dataclass>=2.0.0",
1313
]

snakemake_interface_executor_plugins/executors/real.py

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
from abc import abstractmethod
77
from typing import Dict
8+
9+
from snakemake_interface_common import at_least_snakemake_version
810
from snakemake_interface_executor_plugins.executors.base import (
911
AbstractExecutor,
1012
SubmittedJobInfo,
@@ -79,32 +81,34 @@ def additional_general_args(self):
7981

8082
def get_job_args(self, job: JobExecutorInterface, **kwargs):
8183
unneeded_temp_files = list(self.workflow.dag.get_unneeded_temp_files(job))
82-
return join_cli_args(
83-
[
84-
format_cli_arg(
85-
"--target-jobs", encode_target_jobs_cli_args(job.get_target_spec())
86-
),
87-
# Restrict considered rules for faster DAG computation.
88-
# This does not work for updated jobs because they need
89-
# to be updated in the spawned process as well.
90-
format_cli_arg(
91-
"--allowed-rules",
92-
job.rules,
93-
quote=False,
94-
skip=job.is_updated,
95-
),
96-
# Ensure that a group uses its proper local groupid.
97-
format_cli_arg("--local-groupid", job.jobid, skip=not job.is_group()),
98-
format_cli_arg("--cores", kwargs.get("cores", self.cores)),
99-
format_cli_arg("--attempt", job.attempt),
100-
format_cli_arg("--force-use-threads", not job.is_group()),
101-
format_cli_arg(
102-
"--unneeded-temp-files",
103-
unneeded_temp_files,
104-
skip=not unneeded_temp_files,
105-
),
106-
]
107-
)
84+
arg_list = [
85+
format_cli_arg(
86+
"--target-jobs", encode_target_jobs_cli_args(job.get_target_spec())
87+
),
88+
# Restrict considered rules for faster DAG computation.
89+
format_cli_arg(
90+
"--allowed-rules",
91+
job.rules,
92+
quote=False,
93+
# Via this fix: https://github.com/snakemake/snakemake/pull/3640
94+
# --allowed-rules can be always used. The fix is released in
95+
# snakemake 9.6.2. Before, --allowed-rules had to be skipped
96+
# for jobs that have been updated after checkpoint evaluation.
97+
skip=job.is_updated and not at_least_snakemake_version("9.6.2"),
98+
),
99+
# Ensure that a group uses its proper local groupid.
100+
format_cli_arg("--local-groupid", job.jobid, skip=not job.is_group()),
101+
format_cli_arg("--cores", kwargs.get("cores", self.cores)),
102+
format_cli_arg("--attempt", job.attempt),
103+
format_cli_arg("--force-use-threads", not job.is_group()),
104+
format_cli_arg(
105+
"--unneeded-temp-files",
106+
unneeded_temp_files,
107+
skip=not unneeded_temp_files,
108+
),
109+
]
110+
111+
return join_cli_args(arg_list)
108112

109113
@property
110114
def job_specific_local_groupid(self):

0 commit comments

Comments
 (0)