Hi I’m missing something simple here as I am getting
Can you please help me spot the issue? And advise exactly the bit I need to add? Thx
form.yml
---
cluster: "meerkat"
attributes:
bc_num_hours:
min: 1
max: 8
step: 1
Rserver:
widget: select
label: "RStudio Server Version"
options:
- ["rstudio-server/2025.05.1-513","rstudio-server/2025.05.1-513"]
Rapp:
widget: select
label: "R Version"
options:
- ["4.4.1","r/4.4.1-wz5qfuk"]
- ["4.3.2","r/4.3.2-pathdwe"]
- ["4.2.2","r/4.2.2-43fxu7l"]
- ["4.1.2","r/4.1.2-cq2nxyv"]
- ["3.6.1","r/3.6.1-cxxra2y"]
- ["3.4.4","r/3.4.4-b5beg4x"]
- ["3.3.3","r/3.3.3-tasvtln"]
form:
- Rserver
- Rapp
- bc_num_hours
- bc_email_on_started
Submit.yml.erb
---
batch_connect:
template: "basic"
conn_params:
- csrf_token
templates/script.sh.erb
>> cat script.sh.erb
#!/usr/bin/env bash
module purge
# load RStudio Server
module load <%= context.Rserver %>
##module load rstudio-server/2025.05.1-513
# load R
module load <%= context.Rapp %>
#
# Start RStudio Server
#
# PAM auth helper used by RStudio
export RSTUDIO_AUTH="${PWD}/bin/auth"
# Generate an `rsession` wrapper script
export RSESSION_WRAPPER_FILE="${PWD}/rsession.sh"
(
umask 077
sed 's/^ \{2\}//' > "${RSESSION_WRAPPER_FILE}" << EOL
#!/usr/bin/env bash
# Log all output from this script
export RSESSION_LOG_FILE="${PWD}/rsession.log"
exec &>>"\${RSESSION_LOG_FILE}"
# Launch the original command
echo "Launching rsession..."
set -x
exec rsession --r-libs-user "${R_LIBS_USER}" "\${@}"
EOL
)
chmod 700 "${RSESSION_WRAPPER_FILE}"
# Generate a database.conf file
export DBCONF="${PWD}/database.conf"
(
umask 077
sed 's/^ \{2\}//' > "${DBCONF}" << EOL
# set database location
provider=sqlite
directory=/tmp/${USER}/${SLURM_JOB_ID}/rstudio-server/db
EOL
)
chmod 700 "${DBCONF}"
# Set working directory to home directory
cd "${HOME}"
# Create a unique $TMPDIR for runtime files
# MCRI
export TMPDIR="$(mktemp -d)"
# these are needed to run the container as user
mkdir -p "$TMPDIR/var_run"
mkdir -p "$TMPDIR/var_lib_rstudio-server"
touch "$TMPDIR/var_lib_rstudio-server/rstudio-os.sqlite"
# Output debug info
module list
# Launch the RStudio Server
echo "Starting up rserver..."
set -x
rserver \
--www-port ${port} \
--auth-none 0 \
--auth-pam-helper-path "${RSTUDIO_AUTH}" \
--auth-encrypt-password 0 \
--rsession-path "${RSESSION_WRAPPER_FILE}" \
--server-data-dir "${TMPDIR}" \
--secure-cookie-key-file "${TMPDIR}/rstudio-server/secure-cookie-key" \
--database-config-file "${DBCONF}" \
--server-user $(whoami)