Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Corryvreckan
Corryvreckan
Commits
d8de20ab
Commit
d8de20ab
authored
Apr 22, 2021
by
Jens Kroeger
Browse files
jobsub + Colourer: handle difference between str and byte string in python3
parent
3310fbfd
Changes
2
Hide whitespace changes
Inline
Side-by-side
jobsub/Colorer.py
View file @
d8de20ab
...
...
@@ -90,7 +90,11 @@ def add_coloring_to_emit_ansi(fn):
color
=
'
\x1b
[35m'
# pink
else
:
color
=
'
\x1b
[0m'
# normal
args
[
1
].
msg
=
color
+
args
[
1
].
msg
+
'
\x1b
[0m'
# normal
if
type
(
args
[
1
].
msg
)
==
str
:
args
[
1
].
msg
=
color
+
args
[
1
].
msg
+
'
\x1b
[0m'
# normal
else
:
args
[
1
].
msg
=
color
+
(
args
[
1
].
msg
).
decode
(
'utf-8'
)
+
'
\x1b
[0m'
# normal
#print "after"
return
fn
(
*
args
)
return
new
...
...
jobsub/jobsub.py
View file @
d8de20ab
...
...
@@ -265,22 +265,22 @@ def runCorryvreckan(filenamebase, jobtask, silent):
try
:
line
=
qout
.
get_nowait
()
# or q.get(timeout=.1)
if
not
silent
:
if
"
WARNING
"
in
line
.
strip
():
if
'
WARNING
'
.
encode
()
in
line
.
strip
():
log
.
warning
(
line
.
strip
())
elif
"
ERROR
"
in
line
.
strip
():
elif
b
'
ERROR
'
in
line
.
strip
():
log
.
error
(
line
.
strip
())
elif
"
FATAL
"
in
line
.
strip
():
elif
b
'
FATAL
'
in
line
.
strip
():
log
.
critical
(
line
.
strip
())
else
:
log
.
info
(
line
.
strip
())
log_file
.
write
(
line
)
log_file
.
write
(
str
(
line
,
'utf-8'
)
)
except
Empty
:
pass
try
:
line
=
qerr
.
get_nowait
()
# or q.get(timeout=.1)
log
.
error
(
line
.
strip
())
log_file
.
write
(
line
)
log_file
.
write
(
str
(
line
,
'utf-8'
)
)
except
Empty
:
sleep
(
0.005
)
# sleep for 5 ms to avoid excessive CPU load
...
...
@@ -301,14 +301,14 @@ def runCorryvreckan(filenamebase, jobtask, silent):
log
.
critical
(
line
.
strip
())
else
:
log
.
info
(
line
.
strip
())
log_file
.
write
(
line
)
log_file
.
write
(
str
(
line
,
'utf-8'
)
)
except
Empty
:
pass
try
:
line
=
qerr
.
get_nowait
()
# or q.get(timeout=.1)
log
.
error
(
line
.
strip
())
log_file
.
write
(
line
)
log_file
.
write
(
str
(
line
,
'utf-8'
)
)
except
Empty
:
pass
finally
:
...
...
Write
Preview
Supports
Markdown
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