This is a Bash utility script that allows users to interactively switch to the working directory of a running or queued Slurm job. It simplifies navigation and debugging in Slurm-based HPC environments.
- Lists all jobs submitted by the current user
- Displays job details including
JobId,JobName,WorkDir,NodeList,JobState, andUserId - Interactively selects a job and changes to its working directory
- Provides helpful messages and error handling
- Must be executed in an environment with Slurm installed
- The
scontrolcommand must be available - User must have active or queued jobs to interact with
- Put it into the scripts directory
chmod +x sqcd.sh
cp -f sqcd.sh ~/scripts/
echo "alias sqcd='source ~/scripts/sqcd.sh'" >> ~/.bashrc
source ~/.bashrc
- Use
sqcdeverywhere
$ sqcd
Querying job information...
Current job list:
[1] JobId=123 JobName=test_script WorkDir=/home/user/test NodeList=node1 JobState=RUNNING UserId=user
Please enter the number of the job to switch to: 1
Switching to directory: /home/user/test
Switched successfully! Current directory: /home/user/test