ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/VHbb/python/qstat.py
Revision: 1.1
Committed: Thu Oct 11 12:28:59 2012 UTC (12 years, 7 months ago) by peller
Content type: text/x-python
Branch: MAIN
CVS Tags: workingVersionAfterHCP, hcpApproval, HCP_unblinding, hcpPreApp
Log Message:
a little gadget

File Contents

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