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
6049c1d6
Commit
6049c1d6
authored
1 year ago
by
Tobias Meisel
Browse files
Options
Downloads
Patches
Plain Diff
[logparser] Extend type annotations
parent
b9c39616
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!130
Logparser
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ogstools/logparser/common_ogs_analyses.py
+9
-9
9 additions, 9 deletions
ogstools/logparser/common_ogs_analyses.py
ogstools/logparser/log_parser.py
+5
-5
5 additions, 5 deletions
ogstools/logparser/log_parser.py
with
14 additions
and
14 deletions
ogstools/logparser/common_ogs_analyses.py
+
9
−
9
View file @
6049c1d6
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
# http://www.opengeosys.org/project/license
# http://www.opengeosys.org/project/license
from
typing
import
Callable
from
typing
import
Any
,
Callable
import
numpy
as
np
import
numpy
as
np
import
pandas
as
pd
import
pandas
as
pd
...
@@ -55,8 +55,8 @@ def pre_post_check(interest: list[str], context: list[str]) -> Callable:
...
@@ -55,8 +55,8 @@ def pre_post_check(interest: list[str], context: list[str]) -> Callable:
based on the specified
'
interest
'
and
'
context
'
.
based on the specified
'
interest
'
and
'
context
'
.
"""
"""
def
wrap
(
func
)
:
def
wrap
(
func
:
Callable
[[
Any
],
Any
])
->
Callable
[[
Any
],
Any
]
:
def
wrapped_f
(
df
)
:
def
wrapped_f
(
df
:
Any
)
->
Any
:
_check_input
(
df
,
interest
,
context
)
_check_input
(
df
,
interest
,
context
)
pt
=
func
(
df
)
pt
=
func
(
df
)
_check_output
(
pt
,
interest
,
context
)
_check_output
(
pt
,
interest
,
context
)
...
@@ -67,7 +67,7 @@ def pre_post_check(interest: list[str], context: list[str]) -> Callable:
...
@@ -67,7 +67,7 @@ def pre_post_check(interest: list[str], context: list[str]) -> Callable:
return
wrap
return
wrap
def
analysis_time_step
(
df
:
pd
.
DataFrame
):
def
analysis_time_step
(
df
:
pd
.
DataFrame
)
->
pd
.
DataFrame
:
"""
"""
Analysis with focus on computation time per time step. It combines time step specific measurements
'
output time
'
Analysis with focus on computation time per time step. It combines time step specific measurements
'
output time
'
and
'
time step solution time
'
with iteration specific measurements
'
assembly time
'
,
'
linear solver time
'
,
'
Dirichlet time
'
.
and
'
time step solution time
'
with iteration specific measurements
'
assembly time
'
,
'
linear solver time
'
,
'
Dirichlet time
'
.
...
@@ -88,7 +88,7 @@ def analysis_time_step(df: pd.DataFrame):
...
@@ -88,7 +88,7 @@ def analysis_time_step(df: pd.DataFrame):
return
dfe
return
dfe
def
analysis_simulation
(
df
:
pd
.
DataFrame
):
def
analysis_simulation
(
df
:
pd
.
DataFrame
)
->
pd
.
DataFrame
:
interest
=
[
"
execution_time
"
]
# 'start_time'
interest
=
[
"
execution_time
"
]
# 'start_time'
context
=
[
"
mpi_process
"
]
context
=
[
"
mpi_process
"
]
_check_input
(
df
,
interest
,
context
)
_check_input
(
df
,
interest
,
context
)
...
@@ -98,7 +98,7 @@ def analysis_simulation(df: pd.DataFrame):
...
@@ -98,7 +98,7 @@ def analysis_simulation(df: pd.DataFrame):
return
pt
return
pt
def
analysis_convergence_newton_iteration
(
df
:
pd
.
DataFrame
):
def
analysis_convergence_newton_iteration
(
df
:
pd
.
DataFrame
)
->
pd
.
DataFrame
:
dfe_newton_iteration
=
df
.
copy
()
dfe_newton_iteration
=
df
.
copy
()
interest
=
[
"
dx
"
,
"
x
"
,
"
dx_x
"
]
interest
=
[
"
dx
"
,
"
x
"
,
"
dx_x
"
]
if
"
coupling_iteration
"
in
df
:
if
"
coupling_iteration
"
in
df
:
...
@@ -141,7 +141,7 @@ def analysis_convergence_newton_iteration(df: pd.DataFrame):
...
@@ -141,7 +141,7 @@ def analysis_convergence_newton_iteration(df: pd.DataFrame):
interest
=
[
"
dx
"
,
"
x
"
,
"
dx_x
"
],
interest
=
[
"
dx
"
,
"
x
"
,
"
dx_x
"
],
context
=
[
"
time_step
"
,
"
coupling_iteration
"
,
"
coupling_iteration_process
"
],
context
=
[
"
time_step
"
,
"
coupling_iteration
"
,
"
coupling_iteration_process
"
],
)
)
def
analysis_convergence_coupling_iteration
(
df
:
pd
.
DataFrame
):
def
analysis_convergence_coupling_iteration
(
df
:
pd
.
DataFrame
)
->
pd
.
DataFrame
:
# Coupling iteration column will be modified specific for coupling iteration analysis, modified data can not be used for other analysis ->copy!
# Coupling iteration column will be modified specific for coupling iteration analysis, modified data can not be used for other analysis ->copy!
dfe_convergence_coupling_iteration
=
df
.
copy
()
dfe_convergence_coupling_iteration
=
df
.
copy
()
interest
=
[
"
dx
"
,
"
x
"
,
"
dx_x
"
]
interest
=
[
"
dx
"
,
"
x
"
,
"
dx_x
"
]
...
@@ -169,7 +169,7 @@ def analysis_convergence_coupling_iteration(df: pd.DataFrame):
...
@@ -169,7 +169,7 @@ def analysis_convergence_coupling_iteration(df: pd.DataFrame):
return
pt
return
pt
def
time_step_vs_iterations
(
df
:
pd
.
DataFrame
):
def
time_step_vs_iterations
(
df
:
pd
.
DataFrame
)
->
pd
.
DataFrame
:
interest
=
[
"
iteration_number
"
]
interest
=
[
"
iteration_number
"
]
context
=
[
"
time_step
"
]
context
=
[
"
time_step
"
]
_check_input
(
df
,
interest
,
context
)
_check_input
(
df
,
interest
,
context
)
...
@@ -178,7 +178,7 @@ def time_step_vs_iterations(df: pd.DataFrame):
...
@@ -178,7 +178,7 @@ def time_step_vs_iterations(df: pd.DataFrame):
return
pt
return
pt
def
analysis_simulation_termination
(
df
:
pd
.
DataFrame
):
def
analysis_simulation_termination
(
df
:
pd
.
DataFrame
)
->
pd
.
DataFrame
:
# For full print of messages consider setup jupyter notebook:
# For full print of messages consider setup jupyter notebook:
# pd.set_option('display.max_colwidth', None)
# pd.set_option('display.max_colwidth', None)
interest
=
[
"
message
"
]
interest
=
[
"
message
"
]
...
...
This diff is collapsed.
Click to expand it.
ogstools/logparser/log_parser.py
+
5
−
5
View file @
6049c1d6
...
@@ -7,12 +7,12 @@ import re
...
@@ -7,12 +7,12 @@ import re
from
pathlib
import
Path
from
pathlib
import
Path
from
typing
import
Any
,
Callable
,
Optional
,
Union
from
typing
import
Any
,
Callable
,
Optional
,
Union
from
ogstools.logparser.
ogs_
regexes
import
ogs_regexes
from
ogstools.logparser.regexes
import
Log
,
ogs_regexes
def
_try_match_parallel_line
(
def
_try_match_parallel_line
(
line
:
str
,
line_nr
:
int
,
regex
:
re
.
Pattern
,
pattern_class
line
:
str
,
line_nr
:
int
,
regex
:
re
.
Pattern
,
pattern_class
:
type
[
Log
]
):
)
->
Optional
[
Any
]
:
if
match
:
=
regex
.
match
(
line
):
if
match
:
=
regex
.
match
(
line
):
# Line , Process, Type specific
# Line , Process, Type specific
ts
=
pattern_class
.
type_str
()
ts
=
pattern_class
.
type_str
()
...
@@ -30,8 +30,8 @@ def _try_match_parallel_line(
...
@@ -30,8 +30,8 @@ def _try_match_parallel_line(
def
_try_match_serial_line
(
def
_try_match_serial_line
(
line
:
str
,
line_nr
:
int
,
regex
:
re
.
Pattern
,
pattern_class
line
:
str
,
line_nr
:
int
,
regex
:
re
.
Pattern
,
pattern_class
:
type
[
Log
]
):
)
->
Optional
[
list
[
tuple
[
str
,
Log
]]]
:
if
match
:
=
regex
.
match
(
line
):
if
match
:
=
regex
.
match
(
line
):
# Line , Process, Type specific
# Line , Process, Type specific
ts
=
pattern_class
.
type_str
()
ts
=
pattern_class
.
type_str
()
...
...
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