Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Romain Courteaud
slapos.core
Commits
ee65c76a
Commit
ee65c76a
authored
Aug 06, 2019
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
promise: treat CRITICAL like ERROR
parent
aee0f487
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
slapos/grid/promise/generic.py
slapos/grid/promise/generic.py
+11
-9
No files found.
slapos/grid/promise/generic.py
View file @
ee65c76a
...
...
@@ -47,10 +47,12 @@ PROMISE_LOG_FOLDER_NAME = '.slapgrid/promise/log'
PROMISE_PARAMETER_NAME
=
'extra_config_dict'
LOGLINE_RE
=
r"(\
d{
4}-\
d{
2}-\
d{
2}\
s+
\d{2}:\
d{
2}:\
d{
2})\
s+
\-?\
s*(
\w
{4,7}
)\
s+
\-?\
s+(
\d+\
-
\d{3})\
s+
\-?\
s*(.*)
"
LOGLINE_RE
=
r"(\
d{
4}-\
d{
2}-\
d{
2}\
s+
\d{2}:\
d{
2}:\
d{
2})\
s+
\-?\
s*(
\w
+
)\
s+
\-?\
s+(
\d+\
-
\d{3})\
s+
\-?\
s*(.*)
"
matchLogStr = re.compile(LOGLINE_RE).match
matchLogBytes = re.compile(LOGLINE_RE.encode()).match if PY3 else matchLogStr
ERROR_LEVEL = 'CRITICAL', 'ERROR'
class BaseResult(object):
def __init__(self, problem=False, message=None, date=None):
self.__problem = problem
...
...
@@ -283,16 +285,16 @@ class GenericPromise(with_metaclass(ABCMeta, object)):
continue
match = matchLogStr(line)
if match is not None:
if not only_failure or (only_failure and match.groups()[1] == 'ERROR'):
date, level, tid, msg = match.groups()
if not only_failure or level in ERROR_LEVEL:
result_list.append({
'date': datetime.strptime(
match.groups()[0]
, '%Y-%m-%d %H:%M:%S'),
'status':
match.groups()[1]
,
'message': (m
atch.groups()[3]
+ line_part).strip(),
'date': datetime.strptime(
date
, '%Y-%m-%d %H:%M:%S'),
'status':
level
,
'message': (m
sg
+ line_part).strip(),
})
line_part = ""
else:
line_part += '
\
n
' + line
result_list
return [result_list]
...
...
@@ -358,7 +360,7 @@ class GenericPromise(with_metaclass(ABCMeta, object)):
if transaction_count > result_count:
break
transaction_id = tid
if not only_failure or level
== 'ERROR'
:
if not only_failure or level
in ERROR_LEVEL
:
line_list.insert(0, {
'date': datetime.strptime(date,
'%Y-%m-%d %H:%M:%S'),
...
...
@@ -378,7 +380,7 @@ class GenericPromise(with_metaclass(ABCMeta, object)):
failed = False
message = ""
for result in result_list:
if result['status']
== 'ERROR'
:
if result['status']
in ERROR_LEVEL
:
failed = True
message += "
\
n
%
s
" % result['message']
return failed, message.strip()
...
...
@@ -414,7 +416,7 @@ class GenericPromise(with_metaclass(ABCMeta, object)):
failure_found = 1
while i < result_size and failure_found < failure_amount:
for result in latest_result_list[i]:
if result['status']
== 'ERROR'
:
if result['status']
in ERROR_LEVEL
:
failure_found += 1
break
i += 1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment