File tree Expand file tree Collapse file tree
snakemake_interface_executor_plugins Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from abc import ABC , abstractmethod
22from typing import Mapping
33
4+ from snakemake_interface_executor_plugins .settings import CommonSettings
5+
46
57class SpawnedJobArgsFactoryExecutorInterface (ABC ):
68 @abstractmethod
79 def general_args (
810 self ,
9- pass_default_storage_provider_args : bool = True ,
10- pass_default_resources_args : bool = False ,
11- pass_group_args : bool = False ,
11+ executor_common_settings : CommonSettings ,
1212 ) -> str :
1313 ...
1414
1515 @abstractmethod
16- def precommand (self ) -> str :
16+ def precommand (self , executor_common_settings : CommonSettings ) -> str :
1717 ...
1818
1919 @abstractmethod
Original file line number Diff line number Diff line change @@ -131,7 +131,10 @@ def get_envvar_declarations(self):
131131 defs = " " .join (
132132 f"{ var } ={ repr (value )} " for var , value in self .envvars ().items ()
133133 )
134- return f"export { defs } &&"
134+ if defs :
135+ return f"export { defs } &&"
136+ else :
137+ return ""
135138 else :
136139 return ""
137140
@@ -149,12 +152,10 @@ def format_job_exec(self, job: JobExecutorInterface) -> str:
149152 if suffix :
150153 suffix = f"&& { suffix } "
151154 general_args = self .workflow .spawned_job_args_factory .general_args (
152- pass_default_storage_provider_args = self .common_settings .pass_default_storage_provider_args ,
153- pass_default_resources_args = self .common_settings .pass_default_resources_args ,
154- pass_group_args = self .common_settings .pass_group_args ,
155+ executor_common_settings = self .common_settings
155156 )
156157 precommand = self .workflow .spawned_job_args_factory .precommand (
157- auto_deploy_default_storage_provider = self .common_settings . auto_deploy_default_storage_provider
158+ executor_common_settings = self .common_settings
158159 )
159160 if precommand :
160161 precommand += " &&"
Original file line number Diff line number Diff line change @@ -48,6 +48,11 @@ class CommonSettings:
4848 Number of seconds to wait before starting to check the status of spawned jobs.
4949 pass_group_args : bool
5050 Whether to pass group arguments to spawned jobs.
51+ spawned_jobs_assume_shared_fs: bool
52+ Whether spawned jobs in the executor should always assume a shared FS regardless
53+ of the user provided settings. This should be True if the executor spawns
54+ another non-local executor that runs jobs on the same node.
55+ For example, it is used in snakemake-executor-plugin-slurm-jobstep.
5156 """
5257
5358 non_local_exec : bool
@@ -62,6 +67,7 @@ class CommonSettings:
6267 auto_deploy_default_storage_provider : bool = True
6368 init_seconds_before_status_checks : int = 0
6469 pass_group_args : bool = False
70+ spawned_jobs_assume_shared_fs : bool = False
6571
6672 @property
6773 def local_exec (self ):
Original file line number Diff line number Diff line change 66import asyncio
77from collections import UserDict
88from pathlib import Path
9+ import shlex
910import threading
1011from typing import Any , List
1112from urllib .parse import urlparse
@@ -45,7 +46,9 @@ def format_cli_value(value: Any) -> str:
4546 if isinstance (value , SettingsEnumBase ):
4647 return value .item_to_choice ()
4748 elif isinstance (value , Path ):
48- return str (value )
49+ return shlex .quote (str (value ))
50+ elif isinstance (value , str ):
51+ return shlex .quote (value )
4952 else :
5053 return repr (value )
5154
You can’t perform that action at this time.
0 commit comments