ATLAS Offline Software
Loading...
Searching...
No Matches
python.trfValidation.ignorePatterns Class Reference

Class of patterns that can be ignored from athena logfiles. More...

Inheritance diagram for python.trfValidation.ignorePatterns:
Collaboration diagram for python.trfValidation.ignorePatterns:

Public Member Functions

 __init__ (self, files=['atlas_error_mask.db'], extraSearch=[])
 Load error patterns from files.
 structuredPatterns (self)
 searchPatterns (self)

Protected Member Functions

 _initalisePatterns (self, files)
 _initialiseSerches (self, searchStrings=[])

Protected Attributes

list _structuredPatterns = []
list _searchPatterns = []

Detailed Description

Class of patterns that can be ignored from athena logfiles.

Definition at line 30 of file trfValidation.py.

Constructor & Destructor Documentation

◆ __init__()

python.trfValidation.ignorePatterns.__init__ ( self,
files = ['atlas_error_mask.db'],
extraSearch = [] )

Load error patterns from files.

Load regular expressions to be used in logfile parsing Files to load up structured error patterns from

Parameters
extraSearchExtra regexp strings to search against

Definition at line 36 of file trfValidation.py.

36 def __init__(self, files=['atlas_error_mask.db'], extraSearch = []):
37 # Setup structured search patterns
38 self._structuredPatterns = []
39 self._initalisePatterns(files)
40
41 # Setup extra search patterns
42 self._searchPatterns = []
43 self._initialiseSerches(extraSearch)
44

Member Function Documentation

◆ _initalisePatterns()

python.trfValidation.ignorePatterns._initalisePatterns ( self,
files )
protected

Definition at line 53 of file trfValidation.py.

53 def _initalisePatterns(self, files):
54 for patternFile in files:
55 if patternFile == "None":
56 continue
57 fullName = trfUtils.findFile(os.environ['DATAPATH'], patternFile)
58 if not fullName:
59 msg.warning('Error pattern file {0} could not be found in DATAPATH'.format(patternFile))
60 continue
61 try:
62 with open(fullName) as patternFileHandle:
63 msg.debug('Opened error file {0} from here: {1}'.format(patternFile, fullName))
64
65 for line in patternFileHandle:
66 line = line.strip()
67 if line.startswith('#') or line == '':
68 continue
69 try:
70 # N.B. At the moment release matching is not supported!
71 (who, level, message) = [ s.strip() for s in line.split(',', 2) ]
72 if who == "":
73 # Blank means match anything, so make it so...
74 who = "."
75 reWho = re.compile(who)
76 reMessage = re.compile(message)
77 except ValueError:
78 msg.warning('Could not parse this line as a valid error pattern: {0}'.format(line))
79 continue
80 except re.error as e:
81 msg.warning('Could not parse valid regexp from {0}: {1}'.format(message, e))
82 continue
83
84 msg.debug('Successfully parsed: who={0}, level={1}, message={2}'.format(who, level, message))
85
86 self._structuredPatterns.append({'service': reWho, 'level': level, 'message': reMessage})
87
88 except OSError as xxx_todo_changeme:
89 (errno, errMsg) = xxx_todo_changeme.args
90 msg.warning('Failed to open error pattern file {0}: {1} ({2})'.format(fullName, errMsg, errno))
91
92

◆ _initialiseSerches()

python.trfValidation.ignorePatterns._initialiseSerches ( self,
searchStrings = [] )
protected

Definition at line 93 of file trfValidation.py.

93 def _initialiseSerches(self, searchStrings=[]):
94 for string in searchStrings:
95 try:
96 self._searchPatterns.append(re.compile(string))
97 msg.debug('Successfully parsed additional logfile search string: {0}'.format(string))
98 except re.error as e:
99 msg.warning('Could not parse valid regexp from {0}: {1}'.format(string, e))
100
101
102

◆ searchPatterns()

python.trfValidation.ignorePatterns.searchPatterns ( self)

Definition at line 50 of file trfValidation.py.

50 def searchPatterns(self):
51 return self._searchPatterns
52

◆ structuredPatterns()

python.trfValidation.ignorePatterns.structuredPatterns ( self)

Definition at line 46 of file trfValidation.py.

46 def structuredPatterns(self):
47 return self._structuredPatterns
48

Member Data Documentation

◆ _searchPatterns

list python.trfValidation.ignorePatterns._searchPatterns = []
protected

Definition at line 42 of file trfValidation.py.

◆ _structuredPatterns

list python.trfValidation.ignorePatterns._structuredPatterns = []
protected

Definition at line 38 of file trfValidation.py.


The documentation for this class was generated from the following file: