#!/bin/bash

############ AUTOSUBMIT INPUTS ############
proj_dir=%PROJDIR%
outdir=%common.OUTDIR%
tmpdir=%common.TMPDIR%
script=%common.SCRIPT%
CHUNK=%CHUNK%
###############################

cd ${tmpdir}/sunset/$(basename ${outdir})/

source chunk_to_recipe

# atomic_recipe_number=$(printf "%02d" $CHUNK)
srcdir=${tmpdir}/$(basename ${outdir})

atomic_recipe=${srcdir}/logs/recipes/atomic_recipe_${recipe}.yml

set +eu
source MODULES
set -eu

Rscript ${script} ${atomic_recipe}
