snakemake-executor-plugin-slurm 0.7.0__tar.gz → 0.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of snakemake-executor-plugin-slurm might be problematic. Click here for more details.
- {snakemake_executor_plugin_slurm-0.7.0 → snakemake_executor_plugin_slurm-0.8.0}/PKG-INFO +1 -1
- {snakemake_executor_plugin_slurm-0.7.0 → snakemake_executor_plugin_slurm-0.8.0}/pyproject.toml +1 -1
- {snakemake_executor_plugin_slurm-0.7.0 → snakemake_executor_plugin_slurm-0.8.0}/snakemake_executor_plugin_slurm/__init__.py +30 -10
- {snakemake_executor_plugin_slurm-0.7.0 → snakemake_executor_plugin_slurm-0.8.0}/LICENSE +0 -0
- {snakemake_executor_plugin_slurm-0.7.0 → snakemake_executor_plugin_slurm-0.8.0}/README.md +0 -0
|
@@ -9,12 +9,16 @@ import os
|
|
|
9
9
|
import re
|
|
10
10
|
import subprocess
|
|
11
11
|
import time
|
|
12
|
+
from dataclasses import dataclass, field
|
|
12
13
|
from datetime import datetime, timedelta
|
|
13
|
-
from typing import List, Generator
|
|
14
|
+
from typing import List, Generator, Optional
|
|
14
15
|
import uuid
|
|
15
16
|
from snakemake_interface_executor_plugins.executors.base import SubmittedJobInfo
|
|
16
17
|
from snakemake_interface_executor_plugins.executors.remote import RemoteExecutor
|
|
17
|
-
from snakemake_interface_executor_plugins.settings import
|
|
18
|
+
from snakemake_interface_executor_plugins.settings import (
|
|
19
|
+
ExecutorSettingsBase,
|
|
20
|
+
CommonSettings,
|
|
21
|
+
)
|
|
18
22
|
from snakemake_interface_executor_plugins.jobs import (
|
|
19
23
|
JobExecutorInterface,
|
|
20
24
|
)
|
|
@@ -22,6 +26,21 @@ from snakemake_interface_common.exceptions import WorkflowError
|
|
|
22
26
|
from snakemake_executor_plugin_slurm_jobstep import get_cpus_per_task
|
|
23
27
|
|
|
24
28
|
|
|
29
|
+
@dataclass
|
|
30
|
+
class ExecutorSettings(ExecutorSettingsBase):
|
|
31
|
+
init_seconds_before_status_checks: Optional[int] = field(
|
|
32
|
+
default=40,
|
|
33
|
+
metadata={
|
|
34
|
+
"help": """
|
|
35
|
+
Defines the time in seconds before the first status
|
|
36
|
+
check is performed after job submission.
|
|
37
|
+
""",
|
|
38
|
+
"env_var": False,
|
|
39
|
+
"required": False,
|
|
40
|
+
},
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
25
44
|
# Required:
|
|
26
45
|
# Specify common settings shared by various executors.
|
|
27
46
|
common_settings = CommonSettings(
|
|
@@ -56,14 +75,16 @@ class Executor(RemoteExecutor):
|
|
|
56
75
|
self.logger.info(f"SLURM run ID: {self.run_uuid}")
|
|
57
76
|
self._fallback_account_arg = None
|
|
58
77
|
self._fallback_partition = None
|
|
78
|
+
# providing a short-hand, even if subsequent calls seem redundant
|
|
79
|
+
self.settings: ExecutorSettings = self.workflow.executor_settings
|
|
59
80
|
|
|
60
81
|
def warn_on_jobcontext(self, done=None):
|
|
61
82
|
if not done:
|
|
62
83
|
if "SLURM_JOB_ID" in os.environ:
|
|
63
84
|
self.logger.warning(
|
|
64
|
-
"
|
|
65
|
-
" to unexpected behavior.
|
|
66
|
-
" on the
|
|
85
|
+
"You are running snakemake in a SLURM job context. "
|
|
86
|
+
"This is not recommended, as it may lead to unexpected behavior."
|
|
87
|
+
"Please run Snakemake directly on the login node."
|
|
67
88
|
)
|
|
68
89
|
time.sleep(5)
|
|
69
90
|
done = True
|
|
@@ -140,7 +161,7 @@ class Executor(RemoteExecutor):
|
|
|
140
161
|
if job.resources.get("nodes", False):
|
|
141
162
|
call += f" --nodes={job.resources.get('nodes', 1)}"
|
|
142
163
|
|
|
143
|
-
# fixes #40 - set ntasks
|
|
164
|
+
# fixes #40 - set ntasks regardless of mpi, because
|
|
144
165
|
# SLURM v22.05 will require it for all jobs
|
|
145
166
|
call += f" --ntasks={job.resources.get('tasks', 1)}"
|
|
146
167
|
# MPI job
|
|
@@ -195,7 +216,6 @@ class Executor(RemoteExecutor):
|
|
|
195
216
|
self, active_jobs: List[SubmittedJobInfo]
|
|
196
217
|
) -> Generator[SubmittedJobInfo, None, None]:
|
|
197
218
|
# Check the status of active jobs.
|
|
198
|
-
|
|
199
219
|
# You have to iterate over the given list active_jobs.
|
|
200
220
|
# For jobs that have finished successfully, you have to call
|
|
201
221
|
# self.report_job_success(job).
|
|
@@ -509,10 +529,10 @@ class Executor(RemoteExecutor):
|
|
|
509
529
|
jobname = re.compile(r"--job-name[=?|\s+]|-J\s?")
|
|
510
530
|
if re.search(jobname, job.resources.slurm_extra):
|
|
511
531
|
raise WorkflowError(
|
|
512
|
-
"The
|
|
532
|
+
"The --job-name option is not allowed in the 'slurm_extra' "
|
|
513
533
|
"parameter. The job name is set by snakemake and must not be "
|
|
514
|
-
"overwritten. It is internally used to check the stati of
|
|
515
|
-
"submitted jobs by this workflow."
|
|
534
|
+
"overwritten. It is internally used to check the stati of the "
|
|
535
|
+
"all submitted jobs by this workflow."
|
|
516
536
|
"Please consult the documentation if you are unsure how to "
|
|
517
537
|
"query the status of your jobs."
|
|
518
538
|
)
|
|
File without changes
|
|
File without changes
|