Move SLURM script to jinja template
This commit is contained in:
parent
d091a6fd99
commit
8217d63c41
7 changed files with 108 additions and 68 deletions
|
@ -1,4 +1,4 @@
|
|||
"""Test form templates module."""
|
||||
"""Test template form module."""
|
||||
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
|
20
tests/test_templates.py
Normal file
20
tests/test_templates.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
"""Test Jinja templates module."""
|
||||
|
||||
from glicid_spawner.templates import get_template_src, render_template
|
||||
|
||||
|
||||
def test_template_src():
|
||||
"""Test jinja template source."""
|
||||
src = get_template_src('slurm_script.jinja')
|
||||
|
||||
assert src.startswith('#!/bin/bash\n{#- SLURM batch script for GLiCID spawner #}')
|
||||
assert src.endswith('} > ${JUPYTER_JOB_LOG} 2>&1\n')
|
||||
|
||||
|
||||
def test_template_render():
|
||||
"""Test jinja template render."""
|
||||
src = render_template('slurm_script.jinja', job_name='foo', qos='short', gres='bar', cmd='cmd')
|
||||
|
||||
assert src.startswith('#!/bin/bash\n\n#SBATCH --job-name=foo\n')
|
||||
assert '#SBATCH --export=\n#SBATCH --qos=short\n#SBATCH --gres=bar\n' in src
|
||||
assert src.endswith('cmd;} > ${JUPYTER_JOB_LOG} 2>&1')
|
Loading…
Add table
Add a link
Reference in a new issue