Stable interfaces and functionality for Snakemake executor plugins
This package provides a stable interface for interactions between Snakemake and its executor plugins (WIP).
Plugins should implement the following skeleton to comply with this interface.
It is recommended to use Snakemake's poetry plugin to set up this skeleton (and automated testing) within a python package, see https://github.com/snakemake/poetry-snakemake-plugin.
from dataclasses import dataclass, field
from typing import List, Generator, Optional
from snakemake_interface_executor_plugins.executors.base import SubmittedJobInfo
from snakemake_interface_executor_plugins.executors.remote import RemoteExecutor
from snakemake_interface_executor_plugins.settings import (
ExecutorSettingsBase, CommonSettings
)
from snakemake_interface_executor_plugins.workflow import WorkflowExecutorInterface
from snakemake_interface_executor_plugins.logging import LoggerExecutorInterface
from snakemake_interface_executor_plugins.jobs import (
JobExecutorInterface,
)
@dataclass
class ExecutorSettings(ExecutorSettingsBase):
myparam: Optional[int] = field(
default=None,
metadata={
"help": "Some help text",
"env_var": False,
"parse_func": ...,
"unparse_func": ...,
"required": True,
},
)
common_settings = CommonSettings(
non_local_exec=True,
implies_no_shared_fs=True,
job_deploy_sources=True,
pass_default_storage_provider_args=True,
pass_default_resources_args=True,
pass_envvar_declarations_to_cmd=True,
auto_deploy_default_storage_provider=True,
init_seconds_before_status_checks=0,
)
class Executor(RemoteExecutor):
def __post_init__(self):
self.workflow
self.workflow.executor_settings
def run_job(self, job: JobExecutorInterface):
...
async def check_active_jobs(
self, active_jobs: List[SubmittedJobInfo]
) -> Generator[SubmittedJobInfo, None, None]:
...
def cancel_jobs(self, active_jobs: List[SubmittedJobInfo]):
...