Yaml schemas: data section not generated if I use a specific name for a section
It's a small and sneaky bug:
in the Contacts
section I have a sub_section called contact
. If I call it Contact
, then the processing fails.
In the original schema file I have many sections that use capital letters or same name of the section they inherit from.
Only in this section the processing is failing.
Edit: mind also the lines
target_sub_section:
- contact
where the contact
appears
definitions:
name: 'ELN for MOVPE'
sections:
Movpe_experiment:
base_sections:
- nomad.parsing.tabular.TableData
m_annotations:
eln:
quantities:
data_file:
type: str
description: |
A reference to an uploaded .xlsx
m_annotations:
browser:
adaptor: RawFileAdaptor
eln:
component: FileEditQuantity
tabular_parser:
comment: '#'
mode: root
sub_sections:
Contacts:
section:
base_sections:
- nomad.parsing.tabular.TableData
m_annotations:
eln:
quantities:
data_file:
type: str
default: '#data/data_file'
description: |
A reference to an uploaded .xlsx
m_annotations:
tabular_parser:
comment: '#'
mode: row
target_sub_section:
- contact
browser:
adaptor: RawFileAdaptor
eln:
component: FileEditQuantity
sub_sections:
contact:
repeats: true
section:
base_sections:
- '#/Contact'
Error messages:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/nomad/parsing/tabular.py", line 214, in _prepare_root_tabular_data
getattr(self, sub_section_name).normalize(archive, logger)
File "/usr/local/lib/python3.9/site-packages/nomad/parsing/tabular.py", line 104, in normalize
self.tabular_parser(quantity_def, archive, logger, annotation)
File "/usr/local/lib/python3.9/site-packages/nomad/parsing/tabular.py", line 162, in tabular_parser
self.append_section_to_subsection(section_name, section)
File "/usr/local/lib/python3.9/site-packages/nomad/parsing/tabular.py", line 189, in append_section_to_subsection
self_updated.append(section_updated)
File "/usr/local/lib/python3.9/site-packages/nomad/metainfo/metainfo.py", line 1277, in __getattr__
raise AttributeError(name)
AttributeError: append
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/nomad/processing/base.py", line 1049, in wrapper
rv = func(self, *args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/nomad/processing/data.py", line 964, in process_entry_local
self._process_entry_local()
File "/usr/local/lib/python3.9/site-packages/nomad/processing/data.py", line 1034, in _process_entry_local
entry.archiving()
File "/usr/local/lib/python3.9/site-packages/nomad/processing/data.py", line 1199, in archiving
self._entry_metadata.apply_archive_metadata(self._parser_results)
File "/usr/local/lib/python3.9/site-packages/nomad/datamodel/datamodel.py", line 829, in apply_archive_metadata
for section, property_def, _ in archive.m_traverse():
File "/usr/local/lib/python3.9/site-packages/nomad/metainfo/metainfo.py", line 2374, in m_traverse
for i in sub_section.m_traverse():
File "/usr/local/lib/python3.9/site-packages/nomad/metainfo/metainfo.py", line 2374, in m_traverse
for i in sub_section.m_traverse():
File "/usr/local/lib/python3.9/site-packages/nomad/metainfo/metainfo.py", line 2374, in m_traverse
for i in sub_section.m_traverse():
AttributeError: 'str' object has no attribute 'm_traverse'
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/nomad/processing/base.py", line 1049, in wrapper
rv = func(self, *args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/nomad/processing/data.py", line 964, in process_entry_local
self._process_entry_local()
File "/usr/local/lib/python3.9/site-packages/nomad/processing/data.py", line 1034, in _process_entry_local
entry.archiving()
File "/usr/local/lib/python3.9/site-packages/nomad/processing/data.py", line 1199, in archiving
self._entry_metadata.apply_archive_metadata(self._parser_results)
File "/usr/local/lib/python3.9/site-packages/nomad/datamodel/datamodel.py", line 829, in apply_archive_metadata
for section, property_def, _ in archive.m_traverse():
File "/usr/local/lib/python3.9/site-packages/nomad/metainfo/metainfo.py", line 2374, in m_traverse
for i in sub_section.m_traverse():
File "/usr/local/lib/python3.9/site-packages/nomad/metainfo/metainfo.py", line 2374, in m_traverse
for i in sub_section.m_traverse():
File "/usr/local/lib/python3.9/site-packages/nomad/metainfo/metainfo.py", line 2374, in m_traverse
for i in sub_section.m_traverse():
AttributeError: 'str' object has no attribute 'm_traverse'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/nomad/processing/data.py", line 1087, in _on_fail
self._entry_metadata.apply_archive_metadata(self._parser_results)
File "/usr/local/lib/python3.9/site-packages/nomad/datamodel/datamodel.py", line 829, in apply_archive_metadata
for section, property_def, _ in archive.m_traverse():
File "/usr/local/lib/python3.9/site-packages/nomad/metainfo/metainfo.py", line 2374, in m_traverse
for i in sub_section.m_traverse():
File "/usr/local/lib/python3.9/site-packages/nomad/metainfo/metainfo.py", line 2374, in m_traverse
for i in sub_section.m_traverse():
File "/usr/local/lib/python3.9/site-packages/nomad/metainfo/metainfo.py", line 2374, in m_traverse
for i in sub_section.m_traverse():
AttributeError: 'str' object has no attribute 'm_traverse'
You can reproduce it with the following three files:
Parma_datafile_nomad.xlsx movpe_cnr.schema.archive.yaml base_classes.schema.archive.yaml