Home > Mobile >  Toggle HPC Jobs
Toggle HPC Jobs

Time:04-01

I'm trying to find a covenient way to peek through the jobs I have submited on an HPC system. Currently, I have the function

peek() {ccc_mpeek "$1" | less;}

defined in my .bashrc, where ccc_mpeek is an HPC specific function to see the output file of a running job and the $1 argument is the JOBID.

However, this is still a little incovenient, since I have to manually copy and paste the JOBID (7 digits) when I want to run the function above.

I'm looking for a way in which I can toggle through JOBID's as the argument to the previous function, based on the output of the squeue -u user_name, which has the following header:

         JOBID PARTITION     NAME     USER ST       TIME  NODES NODELIST(REASON)

CodePudding user response:

The squeue command has an option to choose the information that is displayed. In you case, you would run

squeue -h -t R --me -o %i

to remove the header (-h) , filter only "running" jobs (-t R) and only display the job ID (-o %i).

Assuming you have only one job running, you can then define

peek() {ccc_mpeek "$(squeue -t R --me -o %i)" | less;}

If you have multiple jobs running, you will need to adapt it to either show only the first job ( ... | head -1) or iterate through the jobs with a for loop.

  • Related