[GE users] Number of jobs in queue

craffi dag at sonsorol.org
Tue Dec 22 16:55:41 GMT 2009

Another common option is to cache the XML output from SGE to a file once 
a minute or at an interval that makes sense. Then you can point your web 
tools and other reporting code at the cached file rather than the live 


elrond1999 wrote:
> I have a python script that polls qstat -xml for a live view of the jobs in the queue. And as you say that can be a bit intensive, especially with 1000s of jobs. But usually there is just 0-5 jobs running so no problem. So what I wanted was a quick check to get number of jobs and if there are too many just do qstat -s rsah to show running + held jobs. So for now the best I can do is:
> def qstat_num_jobs():
>      cmd_line = "qstat -u '*' |wc -l"
>      (status, output) = commands.getstatusoutput(cmd_line)
>      num = int(output)
>      if num:
>          return num - 2
>      else:
>          return 0
> It would have been better if qstat -g c showed pending jobs as well.
> xml-qstat is a nice web alternative for sure, and my script does not scale well so in the end I might just use that..
> ------------------------------------------------------
> http://gridengine.sunsource.net/ds/viewMessage.do?dsForumId=38&dsMessageId=234593
> To unsubscribe from this discussion, e-mail: [users-unsubscribe at gridengine.sunsource.net].


To unsubscribe from this discussion, e-mail: [users-unsubscribe at gridengine.sunsource.net].

More information about the gridengine-users mailing list