#!/bin/bash
## Has short time limit to test clamr checkpointing

#SBATCH --job-name={{task_name}}-{{task_id}}
#SBATCH --output={{task_save_path}}/{{task_name}}-{{task_id}}.out
#SBATCH --error={{task_save_path}}/{{task_name}}-{{task_id}}.err
#SBATCH --time=00:00:02

{% if 'beeflow:MPIRequirement' in hints and 'nodes' in hints['beeflow:MPIRequirement'] %}
#SBATCH -N {{ hints['beeflow:MPIRequirement']['nodes'] }}
{% endif %}
{% if 'beeflow:MPIRequirement' in hints and 'ntasks' in hints['beeflow:MPIRequirement'] %}
#SBATCH -n {{ hints['beeflow:MPIRequirement']['ntasks'] }}
{% endif %}

{{ env_code }}

# pre commands
{% for cmd in pre_commands %}
srun {{ cmd|join(' ') }}
{% endfor %}

# main command
srun {{ main_command|join(' ') }}

# post commands
{% for cmd in post_commands %}
srun {{ cmd|join(' ') }}
{% endfor %}
