Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OGSTools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ogs
OpenGeoSys Tools
OGSTools
Commits
e33c7b02
Commit
e33c7b02
authored
1 year ago
by
Tobias Meisel
Browse files
Options
Downloads
Patches
Plain Diff
[logparser] Providing regexes to parse_file is optional
parent
6049c1d6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!130
Logparser
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ogstools/logparser/log_parser.py
+6
-3
6 additions, 3 deletions
ogstools/logparser/log_parser.py
with
6 additions
and
3 deletions
ogstools/logparser/log_parser.py
+
6
−
3
View file @
e33c7b02
...
@@ -80,7 +80,7 @@ def parse_file(
...
@@ -80,7 +80,7 @@ def parse_file(
file_name
:
Union
[
str
,
Path
],
file_name
:
Union
[
str
,
Path
],
maximum_lines
:
Optional
[
int
]
=
None
,
maximum_lines
:
Optional
[
int
]
=
None
,
force_parallel
:
bool
=
False
,
force_parallel
:
bool
=
False
,
ogs_res
:
Callable
=
ogs_regexes
,
ogs_res
:
Optional
[
list
]
=
None
,
)
->
list
[
Any
]:
)
->
list
[
Any
]:
"""
"""
Parses a log file from OGS, applying regex patterns to extract specific information,
Parses a log file from OGS, applying regex patterns to extract specific information,
...
@@ -109,11 +109,14 @@ def parse_file(
...
@@ -109,11 +109,14 @@ def parse_file(
process_regex
=
""
process_regex
=
""
try_match
=
_try_match_serial_line
try_match
=
_try_match_serial_line
def
compile_re_fn
(
mpi_process_regex
)
:
def
compile_re_fn
(
mpi_process_regex
:
str
)
->
Callable
[[
str
],
re
.
Pattern
]
:
return
lambda
regex
:
re
.
compile
(
mpi_process_regex
+
regex
)
return
lambda
regex
:
re
.
compile
(
mpi_process_regex
+
regex
)
compile_re
=
compile_re_fn
(
process_regex
)
compile_re
=
compile_re_fn
(
process_regex
)
patterns
=
[(
compile_re
(
k
),
v
)
for
k
,
v
in
ogs_res
()]
if
ogs_res
is
None
:
ogs_res
=
ogs_regexes
()
patterns
=
[(
compile_re
(
k
),
v
)
for
k
,
v
in
ogs_res
]
number_of_lines_read
=
0
number_of_lines_read
=
0
with
file_name
.
open
()
as
file
:
with
file_name
.
open
()
as
file
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment