How can I get qstat
to give me full job names?
I know qstat -r
gives detailed information about the task, but it's too much and the resource requirements are included.
The qstat -r
output is like:
131806 0.25001 tumor_foca ajalali qw 09/29/2014 15:49:41 1 2-100:1
Full jobname: tumor_focality-TCGA-THCA-ratboost_linear_svc
Hard Resources: distribution=wheezy (0.000000)
h_rt=72000 (0.000000)
mem_free=15G (0.000000)
h_vmem=15G (0.000000)
h_stack=256M (0.000000)
Soft Resources:
131807 0.25001 vital_stat ajalali qw 09/29/2014 15:49:41 1 2-100:1
Full jobname: vital_status-TCGA-LGG-ratboost_linear_svc
Hard Resources: distribution=wheezy (0.000000)
h_rt=72000 (0.000000)
mem_free=15G (0.000000)
h_vmem=15G (0.000000)
h_stack=256M (0.000000)
Soft Resources:
Right now my only option is to grep
the output as I need:
$ qstat -r | grep "Full jobname" -B1
--
131806 0.25001 tumor_foca ajalali qw 09/29/2014 15:49:41 1 2-100:1
Full jobname: tumor_focality-TCGA-THCA-ratboost_linear_svc
--
131807 0.25001 vital_stat ajalali qw 09/29/2014 15:49:41 1 2-100:1
Full jobname: vital_status-TCGA-LGG-ratboost_linear_svc
Can I do it better to have a nicer output?
A poor KISS solution :
For me the script of Physical Chemist didn't work so I wrote a very simple script using the xml.tree.ElementTree module which i regard as somewhat easier than xml.dom.minidom
This script works pretty well. It looks like it is from cambridge. http://www.hep.ph.ic.ac.uk/~dbauer/grid/myqstat.py
For Python 3:
For Python 2:
Maybe an easier solution: set SGE_LONG_JOB_NAMES to -1, and qstat will figure out the size of the name column:
Works for me.
Cheers!
I am currently writing my own
qstat
wrapper in order to get a clean, useful and customizable output.Here is the github repository. The project has grown too much for the code to be pasted in this message.
It comes with an installer and should work without any problem with both Python 2.7 and 3 (the installation script makes the modifications if needed).
qjobs -h
provides some help on the available options. I will write a more complete documentation in the following days on the github wiki.I will update this message as often as possible to stick to the current state of the project. Please feel free to comment here (or on github) to ask for features/report problems.
In the near future, I will try to add a fully interactive mode to browse the job list more easily. Of course, the classic text output will be still available (it could be useful to e-mail the output, or for a quick check of the pending/running jobs).
Example output
Command
qjobs
gives:Command
qjobs -o
gives:Command
qjobs -o inek -t
gives (e
is elapsed time since start/sub time, the format is customizable using the Format Spec. Mini-Language of Python;k
is complete queue name, with domain):qjobs -i
gives a complete list of the available 'items'. Each of this item is available as:-o ITEMS
);-t
(e.g.-t s
to count by state as in the two first examples);-s
, default is-s ips
meaning that the job list is sorted by ID, then by priority and finally by state before being printed.The result of
qjobs -i
is: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:
Description of commands:
List jobs as XML:
Remove all newlines:
Add newline before each job entry in the list:
Remove all XML stuff:
Hack to add newline at the end:
Columnize:
Example output