ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/CondorGLoggingInfo.py
Revision: 1.4
Committed: Fri Jan 18 15:42:20 2013 UTC (12 years, 3 months ago) by belforte
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_9_1, CRAB_2_9_1_pre2, CRAB_2_9_1_pre1, CRAB_2_9_0, CRAB_2_9_0_pre2, CRAB_2_9_0_pre1, CRAB_2_8_8, CRAB_2_8_8_pre1, CRAB_2_8_7_patch3, CRAB_2_8_7_patch2, CRAB_2_8_7_patch1, CRAB_2_8_7, CRAB_2_8_7_pre2, CRAB_2_8_7_pre1, CRAB_2_8_6, CRAB_2_8_6_pre1, CRAB_2_8_5_patch3, CRAB_2_8_5_patch2, CRAB_2_8_5_patch1, CRAB_2_8_5, CRAB_2_8_5_pre5, CRAB_2_8_5_pre4, CRAB_2_8_5_pre3, HEAD
Changes since 1.3: +4 -1 lines
Error occurred while calculating annotation data.
Log Message:
also report RemoveReason, for https://savannah.cern.ch/bugs/index.php?99796

File Contents

# Content
1 #!/usr/bin/env python
2
3 import sys
4
5 class CondorGLoggingInfo:
6 def __init__(self) :
7 self._categories = ['Grid error'
8 'Resource unavailable',
9 'Grid error before job started',
10 'Grid error after job started',
11 'Aborted by user',
12 'Application error',
13 'Success']
14 self.category = ''
15 self.reason = ''
16
17 def parseFile(self,filename) :
18
19 # open file
20 try:
21 file = open(filename)
22 except IOError:
23 print ''
24 print 'Could not open file: ',filename
25 return ''
26
27 return self.decodeReason(file.readlines())
28
29 def decodeReason(self, input) :
30 """
31 extract meaningful message from condor_q -l
32 """
33
34 msg = ''
35 for line in input.splitlines() :
36 if line.find('HoldReason') != -1 :
37 msg = 'HoldReason=\n'+ line.split('\"')[-2]
38 break
39 if line.find('RemoveReason') != -1 :
40 msg = 'RemoveReason=\n'+line.split('\"')[-2]
41 break
42
43 if msg.find('authentication with the remote server failed')>=0 :
44 self.category = self._categories[2]
45 else :
46 self.category = self._categories[0]
47
48 self.reason = msg
49
50 return msg
51
52 def getCategory(self) :
53 return self.category
54
55 def getReason(self) :
56 return self.reason
57
58
59 if __name__ == '__main__' :
60
61 info = CondorGLoggingInfo()
62 print info.parseFile(sys.argv[1])