Qstat and Long Job Names

qstat and long job names

This on is a bit messy, but it works as a simple solution to have in the command history. All standard tools. Output is pretty much the same as what you get from a normal qstat call, but you won't get the headers:

One-liner:

qstat -xml | tr '\n' ' ' | sed 's#<job_list[^>]*>#\n#g' \
| sed 's#<[^>]*>##g' | grep " " | column -t

Description of commands:

List jobs as XML:

qstat -xml

Remove all newlines:

tr '\n' ' '

Add newline before each job entry in the list:

sed 's#<job_list[^>]*>#\n#g'

Remove all XML stuff:

sed 's#<[^>]*>##g'

Hack to add newline at the end:

grep " "

Columnize:

column -t

Example output

351996  0.50502  ProjectA_XXXXXXXXX_XXXX_XXXXXX                user123  r   2015-06-25T15:38:41  xxxxx-sim01@xxxxxx02.xxxxx.xxx  1
351997 0.50502 ProjectA_XXX_XXXX_XXX user123 r 2015-06-25T15:39:26 xxxxx-sim01@xxxxxx23.xxxxx.xxx 1
351998 0.50502 ProjectA_XXXXXXXXXXXXX_XXXX_XXXX user123 r 2015-06-25T15:40:26 xxxxx-sim01@xxxxxx14.xxxxx.xxx 1
351999 0.50502 ProjectA_XXXXXXXXXXXXXXXXX_XXXX_XXXX user123 r 2015-06-25T15:42:11 xxxxx-sim01@xxxxxx19.xxxxx.xxx 1
352001 0.50502 ProjectA_XXXXXXXXXXXXXXXXXXXXXXX_XXXX_XXXX user123 r 2015-06-25T15:42:11 xxxxx-sim01@xxxxxx11.xxxxx.xxx 1
352008 0.50501 runXXXX69 usr1 r 2015-06-25T15:49:04 xxxxx-sim01@xxxxxx17.xxxxx.xxx 1
352009 0.50501 runXXXX70 usr1 r 2015-06-25T15:49:04 xxxxx-sim01@xxxxxx01.xxxxx.xxx 1
352010 0.50501 runXXXX71 usr1 r 2015-06-25T15:49:04 xxxxx-sim01@xxxxxx06.xxxxx.xxx 1
352011 0.50501 runXXXX72 usr1 r 2015-06-25T15:49:04 xxxxx-sim01@xxxxxx21.xxxxx.xxx 1
352012 0.50501 runXXXX73 usr1 r 2015-06-25T15:49:04 xxxxx-sim01@xxxxxx13.xxxxx.xxx 1
352013 0.50501 runXXXX74 usr1 r 2015-06-25T15:49:04 xxxxx-sim01@xxxxxx11.xxxxx.xxx 1

Expand columns to see full jobname in Slurm

You should use the format option, with:

sacct --helpformat

you'll see the parameters to show, for instance:

sacct --format="JobID,JobName%30"

will print the job id and the name up to 30 characters:

       JobID                        JobName
------------ ------------------------------
19009 bash
19010 launch.sh
19010.0 hydra_pmi_proxy
19010.1 hydra_pmi_proxy

Now, you can to customize your own output.

delete jobs by grepping qstat output and sending jobid to qdel?

awk

qstat | awk '$6 ~ "01/06" {cmd="qdel " $1; system(cmd); close(cmd)}'

Bash

#!/bin/bash

match="01/06"

while read job; do
set -- $job
if [[ $6 =~ $match ]]; then
qdel "$1"
fi
done < <(qstat)

If you want to do a dry-run, then change qdel "$1" to echo qdel "$1" to see what it would have done.

Which job runs on which node?

You can set directly the squeue output format for most of it. AFAICT, it does not provide CPU usage for each node separately though:

squeue -t R --format="%.20i %.20j %.5t %.5C %R"

Example output:

               JOBID                 NAME    ST  CPUS NODELIST(REASON)
18206767 job_TR1_11_run007188 R 1 node05
18206768 job_TR2_11_run007188 R 1 node13
18207078 job_T1_11_run007188_ R 1 node24
18207079 job_T2_11_run007188_ R 1 node14
18207080 job_T3_11_run007188_ R 1 node17

See man squeue or https://slurm.schedmd.com/squeue.html for more details.

sge qstat name of the default queue?

Assuming by "default" you mean the queue a job will fall to if you do not specify one with the -q switch to qsub, this is difficult.

Out of the box, SGE shouldn't have a hard default queue at all, but the default scheduler will pick a queue for a given submission(if you don't specify one) based on which queue has the lowest load average - this is defined by the scheduler attribute queue_sort_method(see sched_conf(5)). In this case, you'd be guessing at best.

However, if you can guarantee that a real default queue will be set in either the submitter's local .sge_request file or in the global $sge_root/$cluster/common/sge_request file(which defines default switches for qsub, see sge_request(5)), you can certainly parse -q switches out of those.



Related Topics



Leave a reply



Submit