Skip to content

Commit

Permalink
Merge pull request #84 from nesi/dini-dev
Browse files Browse the repository at this point in the history
fixing bugs related to snakemake profile and correct the order in submit.sh
  • Loading branch information
DininduSenanayake authored Oct 15, 2024
2 parents 21ecca7 + 6e7ba34 commit 5bf2e08
Show file tree
Hide file tree
Showing 12 changed files with 1,036 additions and 13 deletions.
39 changes: 39 additions & 0 deletions 08-snakemake/profiles/slurm/CookieCutter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#
# Based on lsf CookieCutter.py
#
import os
import json

d = os.path.dirname(__file__)
with open(os.path.join(d, "settings.json")) as fh:
settings = json.load(fh)


def from_entry_or_env(values, key):
"""Return value from ``values`` and override with environment variables."""
if key in os.environ:
return os.environ[key]
else:
return values[key]


class CookieCutter:

SBATCH_DEFAULTS = from_entry_or_env(settings, "SBATCH_DEFAULTS")
CLUSTER_NAME = from_entry_or_env(settings, "CLUSTER_NAME")
CLUSTER_CONFIG = from_entry_or_env(settings, "CLUSTER_CONFIG")

@staticmethod
def get_cluster_option() -> str:
cluster = CookieCutter.CLUSTER_NAME
if cluster != "":
return f"--cluster={cluster}"
return ""

@staticmethod
def get_cluster_logpath() -> str:
return "logs/slurm/%r/%j"

@staticmethod
def get_cluster_jobname() -> str:
return "%r_%w"
Binary file not shown.
Binary file not shown.
29 changes: 29 additions & 0 deletions 08-snakemake/profiles/slurm/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

cluster-sidecar: "slurm-sidecar.py"
cluster-cancel: "scancel"
restart-times: "2"
jobscript: "slurm-jobscript.sh"
cluster: "slurm-submit.py"
cluster-status: "slurm-status.py"
max-jobs-per-second: "10"
max-status-checks-per-second: "10"
local-cores: 1
latency-wait: "5"
use-conda: "False"
use-singularity: "False"
jobs: "500"
printshellcmds: "True"

# Example resource configuration
# default-resources:
# - runtime=100
# - mem_mb=6000
# - disk_mb=1000000
# # set-threads: map rule names to threads
# set-threads:
# - single_core_rule=1
# - multi_core_rule=10
# # set-resources: map rule names to resources in general
# set-resources:
# - high_memory_rule:mem_mb=12000
# - long_running_rule:runtime=1200
5 changes: 5 additions & 0 deletions 08-snakemake/profiles/slurm/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"SBATCH_DEFAULTS": "",
"CLUSTER_NAME": "eri",
"CLUSTER_CONFIG": ""
}
3 changes: 3 additions & 0 deletions 08-snakemake/profiles/slurm/slurm-jobscript.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
# properties = {properties}
{exec_job}
Loading

0 comments on commit 5bf2e08

Please sign in to comment.