|
5 | 5 |
|
6 | 6 | from abc import abstractmethod |
7 | 7 | from typing import Dict |
| 8 | + |
| 9 | +from snakemake_interface_common import at_least_snakemake_version |
8 | 10 | from snakemake_interface_executor_plugins.executors.base import ( |
9 | 11 | AbstractExecutor, |
10 | 12 | SubmittedJobInfo, |
@@ -79,32 +81,34 @@ def additional_general_args(self): |
79 | 81 |
|
80 | 82 | def get_job_args(self, job: JobExecutorInterface, **kwargs): |
81 | 83 | 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) |
108 | 112 |
|
109 | 113 | @property |
110 | 114 | def job_specific_local_groupid(self): |
|
0 commit comments