# Batch\_connect app with permission denied in generated slurm script while generating connect.yml file

**URL:** <https://discourse.openondemand.org/t/batch-connect-app-with-permission-denied-in-generated-slurm-script-while-generating-connect-yml-file/4905>\
**Category:** Get Help\
**Tags:** question\
**Created:** [June 24, 2026, 2:26pm UTC](https://discourse.openondemand.org/t/batch-connect-app-with-permission-denied-in-generated-slurm-script-while-generating-connect-yml-file/4905 "2026-06-24T14:26:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![omar-valerio](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/omar-valerio/32/3438_2.png) [@omar-valerio](https://discourse.openondemand.org/u/omar-valerio)\
**Post date:** [June 24, 2026, 2:26pm UTC](https://discourse.openondemand.org/t/batch-connect-app-with-permission-denied-in-generated-slurm-script-while-generating-connect-yml-file/4905/1 "2026-06-24T14:26:50Z")

</div>

Hello Team,

I want to ask your help to understand/fix the following error.

I’m setting up a _batch\_connect_ app to configure and start a vLLM + OpenHands session in our local cluster.

The error happens during the slurm script execution on the compute node. I can see the host portion of the ``connection.yml`` is populated, and then the permission denied showing in the `output.log`:

`Script starting...`  
`Generating connection YAML file...`  
`/var/spool/slurm/d/job33111772/slurm_script: line 144: /gpfs/home/myuser/ondemand/data/sys/dashboard/batch_connect/dev/ood-vllm/output/0a37d2a6-6208-4c3a-95a8-7ca95943b3dc/script.sh: Permission denied`

When I open the ``connection.yml`` file I can see only the host is there:  
```  
`host: hpcgpu020`  
`port: `  
`password: `  
```  
The template `script.sh` uses Python socket library to find a free port for vLLM. I’m guessing that is the problem, but I cannot understand/explain exactly why.

Here is how that script looks:

```auto
#!/usr/bin/env bash

set -euo pipefail
cd "${HOME}"

CONDA_BASE_FALLBACK="/gpfs/hpc_fs/scratch/conda"
VLLM_CONDA_ENV="vllm-serve"
OPENHANDS_CONDA_ENV="openhands-ai"

# Shared HuggingFace model cache on GPFS.
HF_HOME_SHARED="/gpfs/hpc_fs/scratch/hf-cache"

# Outbound HTTP proxy used by compute nodes.
PROXY_HOST="hpclogin01"
PROXY_PORT="3128"

# =============================================================================
# 1. ENVIRONMENT
# =============================================================================
module purge 2>/dev/null || true

module load miniforge3 2>/dev/null || true
CONDA_BASE=$(conda info --base 2>/dev/null || echo "${CONDA_BASE_FALLBACK}")
echo "[conda] base environment: ${CONDA_BASE}"

_HOST=$(hostname)
_HOST_IP=$(hostname -i 2>/dev/null | awk '{print $1}' || echo "127.0.0.1")

# =============================================================================
# 2. PORT DISCOVERY
# Two ports: one for vLLM, one reserved for OpenHands.
# =============================================================================
_free_port() {
    python3 -c \
        'import socket; s=socket.socket(); s.bind(("",0)); p=s.getsockname()[1]; s.close(); print(p)'
}
VLLM_PORT=$(_free_port)
OPENHANDS_PORT=$(_free_port)

# =============================================================================
# 3. WRITE connection.yml
# OOD reads this YAML file and makes every key available as a local variable
# in view.html.erb. Starting with vllm_ready=false; the health-check loop
# flips that flag to "true" once /health responds.
# =============================================================================
STAGED_ROOT="/gpfs/hpc_fs/home/hpcuser/ondemand/data/sys/dashboard/batch_connect/dev/ood-vllm/output/0a37d2a6-6208-4c3a-95a8-7ca95943b3dc"
CONNECTION_YML="${STAGED_ROOT}/connection.yml"

cat > "${CONNECTION_YML}" << EOL
---
host: ${_HOST}
port: ${VLLM_PORT}
vllm_port: ${VLLM_PORT}
openhands_port: ${OPENHANDS_PORT}
model_repo_id: "${MODEL_REPO_ID}"
model_served_name: "${MODEL_SERVED_NAME}"
hardware_pool: "${HARDWARE_POOL}"
gpu_count: "${GPU_COUNT}"
enable_openhands: "${ENABLE_OPENHANDS}"
vllm_ready: "false"
EOL
echo "[ood] connection.yml initialised at ${CONNECTION_YML}"

```

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [June 24, 2026, 3:54pm UTC](https://discourse.openondemand.org/t/batch-connect-app-with-permission-denied-in-generated-slurm-script-while-generating-connect-yml-file/4905/2 "2026-06-24T15:54:00Z")

</div>

It could actually be that `template/script.sh.erb` isn’t 755 or executable at all. Line 144 of `job_script_content.sh` is trying to execute `.../0a37d2a6-6208-4c3a-95a8-7ca95943b3dc/script.sh` right?

---

<div class="post-metadata">

**Author:** ![omar-valerio](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/omar-valerio/32/3438_2.png) [@omar-valerio](https://discourse.openondemand.org/u/omar-valerio)\
**Post date:** [June 25, 2026, 8:45am UTC](https://discourse.openondemand.org/t/batch-connect-app-with-permission-denied-in-generated-slurm-script-while-generating-connect-yml-file/4905/3 "2026-06-25T08:45:36Z")

</div>

Thanks @jeff.ohrstrom! You nailed it _as usual_.. 👌

And thank you as well for reminding me, the job script should also have **read** permissions set for all. I tend to only do a `chmod +x ...` every time and that will probably create other issues down the road. 💣

I have a question regarding the ERB templates. Why is that the OOD team choose Ruby as an script language for those. Do you guys have plans to also support Python. And is there any linter or syntax checking tool that you can recommend using for the `submit.yml.erb` and `view.html.erb` files?

I currently use this idiom:

`$ erb -T - -x submit.yml.erb | ruby -c`  
`Syntax OK`

But I have the impression there might be a better tool for that.

Thanks again for saving me a few hours of headache. 🙏

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [June 25, 2026, 12:59pm UTC](https://discourse.openondemand.org/t/batch-connect-app-with-permission-denied-in-generated-slurm-script-while-generating-connect-yml-file/4905/4 "2026-06-25T12:59:04Z")

</div>

> [@omar-valerio](#):
>
> Why is that the OOD team choose Ruby as an script language for those. Do you guys have plans to also support Python

The dashboard application is Ruby on Rails, so that’s why it’s Ruby. We don’t have any plans to support python.

> [@omar-valerio](#):
>
> But I have the impression there might be a better tool for that.

I think that that’s likely your best option, though I don’t know of any others.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/b/bae70bd0ed39a3ae769c2108155f4cb3e9da8385.png) [@system](https://discourse.openondemand.org/u/system)\
**Post date:** [June 27, 2026, 12:59pm UTC](https://discourse.openondemand.org/t/batch-connect-app-with-permission-denied-in-generated-slurm-script-while-generating-connect-yml-file/4905/5 "2026-06-27T12:59:07Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
