diff --git a/README.md b/README.md index 782140a..fb1453d 100644 --- a/README.md +++ b/README.md @@ -88,7 +88,7 @@ class Executor(RemoteExecutor): # access workflow self.workflow # access executor specific settings - self.workflow.executor_settings + self.executor_settings # IMPORTANT: in your plugin, only access methods and properties of # Snakemake objects (like Workflow, Persistence, etc.) that are diff --git a/snakemake_interface_executor_plugins/executors/base.py b/snakemake_interface_executor_plugins/executors/base.py index 1f16f36..672d47d 100644 --- a/snakemake_interface_executor_plugins/executors/base.py +++ b/snakemake_interface_executor_plugins/executors/base.py @@ -9,6 +9,7 @@ from snakemake_interface_executor_plugins.jobs import JobExecutorInterface from snakemake_interface_executor_plugins.logging import LoggerExecutorInterface +from snakemake_interface_executor_plugins.settings import ExecutorSettingsBase from snakemake_interface_executor_plugins.utils import format_cli_arg from snakemake_interface_executor_plugins.workflow import WorkflowExecutorInterface @@ -25,9 +26,11 @@ def __init__( self, workflow: WorkflowExecutorInterface, logger: LoggerExecutorInterface, + executor_settings: Optional[ExecutorSettingsBase], ): self.workflow = workflow self.dag = workflow.dag + self.executor_settings = executor_settings self.logger = logger def get_resource_declarations_dict(self, job: JobExecutorInterface): diff --git a/snakemake_interface_executor_plugins/executors/real.py b/snakemake_interface_executor_plugins/executors/real.py index bfc072d..641145c 100644 --- a/snakemake_interface_executor_plugins/executors/real.py +++ b/snakemake_interface_executor_plugins/executors/real.py @@ -4,7 +4,7 @@ __license__ = "MIT" from abc import abstractmethod -from typing import Dict +from typing import Dict, Optional from snakemake_interface_common import at_least_snakemake_version from snakemake_interface_executor_plugins.executors.base import ( @@ -12,7 +12,7 @@ SubmittedJobInfo, ) from snakemake_interface_executor_plugins.logging import LoggerExecutorInterface -from snakemake_interface_executor_plugins.settings import ExecMode +from snakemake_interface_executor_plugins.settings import ExecMode, ExecutorSettingsBase from snakemake_interface_executor_plugins.utils import ( encode_target_jobs_cli_args, format_cli_arg, @@ -27,13 +27,15 @@ def __init__( self, workflow: WorkflowExecutorInterface, logger: LoggerExecutorInterface, + executor_settings: Optional[ExecutorSettingsBase], post_init: bool = True, ): super().__init__( workflow, logger, + executor_settings, ) - self.executor_settings = self.workflow.executor_settings + self.executor_settings = executor_settings self.snakefile = workflow.main_snakefile if post_init: self.__post_init__() diff --git a/snakemake_interface_executor_plugins/settings.py b/snakemake_interface_executor_plugins/settings.py index 704a4b1..14cd44b 100644 --- a/snakemake_interface_executor_plugins/settings.py +++ b/snakemake_interface_executor_plugins/settings.py @@ -176,16 +176,10 @@ def assume_common_workdir(self) -> bool: ) -class DeploymentMethod(SettingsEnumBase): - CONDA = 0 - APPTAINER = 1 - ENV_MODULES = 2 - - class DeploymentSettingsExecutorInterface(ABC): @property @abstractmethod - def deployment_method(self) -> Set[DeploymentMethod]: ... + def deployment_method(self) -> Set[str]: ... class GroupSettingsExecutorInterface(ABC): diff --git a/snakemake_interface_executor_plugins/workflow.py b/snakemake_interface_executor_plugins/workflow.py index 868d75d..2f91059 100644 --- a/snakemake_interface_executor_plugins/workflow.py +++ b/snakemake_interface_executor_plugins/workflow.py @@ -9,6 +9,7 @@ from snakemake_interface_executor_plugins.cli import ( SpawnedJobArgsFactoryExecutorInterface, ) +from snakemake_interface_executor_plugins.dag import DAGExecutorInterface from snakemake_interface_executor_plugins.persistence import ( PersistenceExecutorInterface, ) @@ -25,6 +26,10 @@ class WorkflowExecutorInterface(ABC): + @property + @abstractmethod + def dag(self) -> DAGExecutorInterface: ... + @property @abstractmethod def spawned_job_args_factory(self) -> SpawnedJobArgsFactoryExecutorInterface: ...