Skip to content

Commit

Permalink
Changed interface
Browse files Browse the repository at this point in the history
  • Loading branch information
lauri-codes committed Apr 18, 2024
1 parent dd94e69 commit a2a0b03
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions simulationworkflownormalizer/normalizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ def __init__(self, entry_archive: EntryArchive):
self._phonon_programs = ['phonopy']
self._molecular_dynamics_programs = ['lammps']

def _resolve_workflow(self):
def _resolve_workflow(self, archive: EntryArchive):
if not self.entry_archive.run:
return

# resolve it from parser
workflow = None
try:
program_name = self.entry_archive.run[-1].program.name
program_name = archive.run[-1].program.name
except Exception:
program_name = None

Expand All @@ -73,13 +73,13 @@ def _resolve_workflow(self):

return workflow

def normalize(self, logger=None) -> None:
def normalize(self, archive: EntryArchive, logger=None) -> None:
logger = logger if logger is not None else get_logger(__name__)
super().normalize(logger)

# Do nothing if section_run is not present
if not self.entry_archive.run:
# Do nothing if run section is not present
if not archive.run:
return

if not self.entry_archive.workflow2:
self.entry_archive.workflow2 = self._resolve_workflow()
if not archive.workflow2:
archive.workflow2 = self._resolve_workflow(archive)

0 comments on commit a2a0b03

Please sign in to comment.