Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
83b211c9
Commit
83b211c9
authored
Dec 20, 2019
by
Markus Scheidgen
Browse files
Fixed dos handling in aim parser. Allow to open subsections of closed parents.
parent
c261771d
Pipeline
#66502
passed with stages
in 16 minutes and 38 seconds
Changes
5
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
nomad-meta-info
@
5bfbdf09
Compare
4157d084
...
5bfbdf09
Subproject commit
4157d084e43ec08ad2f4975a276e89fa51dcd535
Subproject commit
5bfbdf09cbd0e9a2934467bdeca569296952ee06
fhi-aims
@
d41ed9c3
Compare
0d5765de
...
d41ed9c3
Subproject commit
0d5765ded1e24c5dd22be98c21d6c9284d06ec51
Subproject commit
d41ed9c3e636b1638e904b6459262a610c62dad2
python_common
@
b3159851
Compare
c161aa0f
...
b3159851
Subproject commit
c161aa0f8649f8431cf3ad6e0afc509000460161
Subproject commit
b3159851a99a4ff6a5ee13dbe204cc0a72aff81e
nomad/parsing/backend.py
View file @
83b211c9
...
...
@@ -91,7 +91,7 @@ class AbstractParserBackend(metaclass=ABCMeta):
pass
@
abstractmethod
def
openSection
(
self
,
metaName
):
def
openSection
(
self
,
metaName
,
parent_index
=-
1
):
""" Opens a new section and returns its new unique gIndex. """
pass
...
...
@@ -433,9 +433,9 @@ class LocalBackend(LegacyParserBackend, metaclass=DelegatingMeta):
super
().
finishedParsingSession
(
*
args
,
**
kwargs
)
self
.
_delegate
.
finishedParsingSession
(
*
args
,
**
kwargs
)
def
openSection
(
self
,
metaName
:
str
)
->
int
:
def
openSection
(
self
,
metaName
:
str
,
parent_index
:
int
=
-
1
)
->
int
:
if
self
.
_open_context
is
None
:
return
self
.
_delegate
.
openSection
(
metaName
)
return
self
.
_delegate
.
openSection
(
metaName
,
parent_index
=
parent_index
)
else
:
assert
self
.
_context_section
is
not
None
...
...
tests/test_parsing.py
View file @
83b211c9
...
...
@@ -185,6 +185,42 @@ class TestLocalBackend(object):
assert
len
(
runs
[
0
][
'section_method'
])
==
2
assert
len
(
runs
[
1
][
'section_method'
])
==
1
def
test_open_section_of_specific_parent
(
self
,
backend
:
LocalBackend
,
no_warn
):
run_index
=
backend
.
openSection
(
'section_run'
)
scc_index
=
backend
.
openSection
(
'section_single_configuration_calculation'
)
backend
.
closeSection
(
'section_single_configuration_calculation'
,
scc_index
)
dos_index
=
backend
.
openSection
(
'section_dos'
,
parent_index
=
scc_index
)
backend
.
closeSection
(
'section_dos'
,
dos_index
)
backend
.
closeSection
(
'section_run'
,
run_index
)
runs
=
backend
.
data
[
'section_run'
]
assert
len
(
runs
)
==
1
run
=
runs
[
0
]
assert
len
(
run
[
'section_single_configuration_calculation'
])
==
1
assert
'section_dos'
in
run
[
'section_single_configuration_calculation'
][
0
]
assert
len
(
run
[
'section_single_configuration_calculation'
][
0
][
'section_dos'
])
==
1
def
test_open_section_of_specific_parent2
(
self
,
backend
:
LocalBackend
,
no_warn
):
run_index
=
backend
.
openSection
(
'section_run'
)
scc_index
=
backend
.
openSection
(
'section_single_configuration_calculation'
)
backend
.
closeSection
(
'section_single_configuration_calculation'
,
scc_index
)
backend
.
closeSection
(
'section_single_configuration_calculation'
,
backend
.
openSection
(
'section_single_configuration_calculation'
))
dos_index
=
backend
.
openSection
(
'section_dos'
,
parent_index
=
scc_index
)
backend
.
closeSection
(
'section_dos'
,
dos_index
)
backend
.
closeSection
(
'section_run'
,
run_index
)
runs
=
backend
.
data
[
'section_run'
]
assert
len
(
runs
)
==
1
run
=
runs
[
0
]
assert
len
(
run
[
'section_single_configuration_calculation'
])
==
2
assert
'section_dos'
in
run
[
'section_single_configuration_calculation'
][
0
]
assert
len
(
run
[
'section_single_configuration_calculation'
][
0
][
'section_dos'
])
==
1
assert
'section_dos'
not
in
run
[
'section_single_configuration_calculation'
][
1
]
def
test_context
(
self
,
backend
:
LocalBackend
,
no_warn
):
backend
.
openSection
(
'section_run'
)
backend
.
openSection
(
'section_method'
)
...
...
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