Skip to content

Commit

Permalink
get rid of unnecessary env var checks
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneskoester committed Sep 8, 2023
1 parent 844f3ee commit b60dc3d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
12 changes: 1 addition & 11 deletions snakemake_executor_plugin_slurm_jobstep/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
ExecutorJobInterface,
)
from snakemake_interface_executor_plugins.settings import ExecMode
from snakemake_interface_common.exceptions import WorkflowError


# Required:
Expand Down Expand Up @@ -54,17 +53,8 @@ def __init__(
pass_envvar_declarations_to_cmd=False,
)
# These environment variables are set by SLURM.

self.mem_per_node = os.getenv("SLURM_MEM_PER_NODE")
self.cpus_on_node = os.getenv("SLURM_CPUS_ON_NODE")
# only needed for commented out jobstep handling below
self.jobid = os.getenv("SLURM_JOB_ID")
if self.jobid is None:
raise WorkflowError(
"Environment variable SLURM_JOB_ID is not set, which is unsupported. "
"Note that the slurm-jobstep executor plugin can only be used inside "
"of SLURM jobs and is meant to be triggered only by the slurm executor "
"plugin."
)

def run_job(self, job: ExecutorJobInterface):
# Implement here how to run a job.
Expand Down
7 changes: 0 additions & 7 deletions tests/tests.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import os
from typing import Optional
import snakemake.common.tests
from snakemake_interface_executor_plugins import ExecutorSettingsBase


# fake slurm job environment
os.environ["SLURM_JOB_ID"] = "100"
os.environ["SLURM_MEM_PER_NODE"] = "100"
os.environ["SLURM_CPUS_ON_NODE"] = "1"


class TestWorkflowsBase(snakemake.common.tests.TestWorkflowsBase):
__test__ = True

Expand Down

0 comments on commit b60dc3d

Please sign in to comment.