Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CNMS
CNMS_Computing_Resources
Commits
5f6f33c7
Commit
5f6f33c7
authored
Mar 01, 2017
by
Doak, Peter W
Browse files
list of lists for parsing headers now supported
parent
daaa4e41
Changes
1
Hide whitespace changes
Inline
Side-by-side
utility/watch_server/watch_server.py
View file @
5f6f33c7
...
...
@@ -87,15 +87,16 @@ def read_output_influx(log):
int
(
time
.
time
())))
influx_lines
.
append
(
influx_point
)
if
'header'
in
config
:
for
find_this
,
then_do
in
config
[
'header'
].
iteritems
():
for
find_this
,
then_do
s
in
config
[
'header'
].
iteritems
():
match
=
re
.
search
(
find_this
,
line
)
if
match
:
try
:
the_value
=
(
line
.
split
())[
then_do
[
0
]
-
1
]
print
line
.
split
()
the_value
=
re
.
sub
(
r
':'
,
r
''
,
the_value
)
print
"Header -- {}: {}"
.
format
(
then_do
[
1
],
the_value
)
influx_point
=
(
"header,user_name={},code={},"
for
then_do
in
then_dos
:
the_value
=
(
line
.
split
())[
then_do
[
0
]
-
1
]
print
line
.
split
()
the_value
=
re
.
sub
(
r
':'
,
r
''
,
the_value
)
print
"Header -- {}: {}"
.
format
(
then_do
[
1
],
the_value
)
influx_point
=
(
"header,user_name={},code={},"
"host={} {}={} {}
\n
"
.
format
(
config
[
'user_name'
],
config
[
'job_prefix'
],
...
...
@@ -103,8 +104,8 @@ def read_output_influx(log):
then_do
[
1
],
the_value
,
int
(
time
.
time
())))
influx_lines
.
append
(
influx_point
)
watch_log
.
write
(
"Header -- {}: {}
\n
"
.
format
(
then_do
[
1
],
the_value
))
influx_lines
.
append
(
influx_point
)
watch_log
.
write
(
"Header -- {}: {}
\n
"
.
format
(
then_do
[
1
],
the_value
))
except
IndexError
as
ie
:
print
"found"
,
find_this
,
"index error, no column "
,
ie
,
" in: "
print
line
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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