# Debugging Workloads and Interactive Jobs

Often dropping into a shell is the easiest way to hammer out development / debugging work. To get a shell access to a node, use a combination of `salloc` and `srun` commands.

```
tensorwave@tensorwave.com@slurm-login-skip-8566547b9c-zdznk:~$ salloc -N 1 --gpus-per-node=8
salloc: Granted job allocation 269
salloc: Waiting for resource configuration
salloc: Nodes tus1-p13-g41 are ready for job
tensorwave@tensorwave.com@slurm-login-skip-8566547b9c-zdznk:~$ srun --pty bash
tensorwave@tensorwave.com@tus1-p13-g41:~$ # <== bash shell on a worker node
```

`salloc` reserves a resource allocation. It creates a sub-shell tied to a SLRUM allocation, and allows users to call `srun` multiple times on the same set of resrouces. This provides much faster iteration time than calling `srun`/`sbatch` from a login node and having to wait for a resource allocation each time, especially for debugging multi-node jobs.

`srun --pty bash` launches the bash shell on the worker pods. The `--pty` flag sets up a psudoshell, forwarding stdin, stdout, and stderr to the terminal. The `--pty` flag is also useful for `srun` commands with complex outputs like `docker build` or python tools with `tqdm` progress bars.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tensorwave.com/slurm/debugging-workloads-and-interactive-jobs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
