Make a slurm allocation and run a program. The allocation is given up when the program ends.
If you don't specify a program it will run bash, which won't end until you type exit.
salloc -n 10 srun hostname srun -n 5 hostname
The first srun will run ten copies of hostname. The second will run 5 (with the 10 cores allocated using salloc).
Note: I couldn't get salloc to run a script even though the documentation says it will.