ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/VHbb/python/qstat.py
Revision: 1.2
Committed: Fri Mar 8 10:04:15 2013 UTC (12 years, 2 months ago) by peller
Content type: text/x-python
Branch: MAIN
CVS Tags: LHCP_PreAppFreeze
Changes since 1.1: +4 -1 lines
Log Message:
qstat user option

File Contents

# User Rev Content
1 peller 1.1 #!/usr/bin/env python
2     import os,sys
3     from time import sleep
4 peller 1.2 p = sys.argv
5     p[0] = 'qstat'
6     pj = ' '.join(p)
7 peller 1.1 class progbar:
8     def __init__(self,width):
9     self.width=width
10     sys.stdout.write("\033[1;47m%s\033[1;m" % (" " * width))
11     sys.stdout.flush()
12     sys.stdout.write("\b" * (width+1))
13     def move(self):
14     sys.stdout.write("\033[1;42m \033[1;m")
15     sys.stdout.flush()
16     def getnum():
17 peller 1.2 q=os.popen(pj)
18 peller 1.1 num=len(q.readlines())
19     if num > 2: return num-2
20     else: return 0
21     num = getnum()
22     print 'You have %s jobs in total'%num
23     progress = progbar(num)
24     while num > 0:
25     sleep(5)
26     num2 = getnum()
27     diff=num-num2
28     if diff > 0:
29     for i in range(0,diff): progress.move()
30     num=num2
31     print '\ndone! :)'