Skip to content

Commit f7403ca

Browse files
committed
Fix structlog error
1 parent e27adc2 commit f7403ca

File tree

1 file changed

+16
-1
lines changed
  • src/nomad_simulation_parsers/parsers/octopus

1 file changed

+16
-1
lines changed

src/nomad_simulation_parsers/parsers/octopus/parser.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,37 @@
44
from nomad.parsing.file_parser import ArchiveWriter
55
from nomad.parsing.file_parser.mapping_parser import MetainfoParser, TextParser
66
from nomad.parsing.parser import MatchingParser
7+
from nomad.utils import get_logger
78
from nomad_simulations.schema_packages.general import Program, Simulation
89
from structlog.stdlib import BoundLogger
910

1011
from nomad_simulation_parsers.schema_packages import octopus
1112

1213
from .file_parsers import OutParser
1314

15+
LOGGER = get_logger(__name__)
16+
1417

1518
class OctopusMainfileParser(TextParser):
19+
# TODO temporary fix for structlog unable to propagate logger
20+
@property
21+
def logger(self):
22+
return LOGGER
23+
1624
def get_header(self, header: list[list[str]]) -> dict[str, str]:
1725
return {key: val for key, val in header.get('options', [])}
1826

1927

28+
class OctopusMetainfoParser(MetainfoParser):
29+
# TODO temporary fix for structlog unable to propagate logger
30+
@property
31+
def logger(self):
32+
return LOGGER
33+
34+
2035
class OctopusArchiveWriter(ArchiveWriter):
2136
mainfile_parser = OctopusMainfileParser(text_parser=OutParser())
22-
archive_parser = MetainfoParser()
37+
archive_parser = OctopusMetainfoParser()
2338

2439
def write_to_archive(self) -> None:
2540
# Reload the octopus package to update the mapping annotations

0 commit comments

Comments
 (0)