Skip to content

Commit

Permalink
parser check for successful calc, wall time input added
Browse files Browse the repository at this point in the history
  • Loading branch information
LucR31 committed Oct 19, 2023
1 parent beedf56 commit 976e7a0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
3 changes: 1 addition & 2 deletions aiida_flexpart/calculations/flexpart_cosmo.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ def define(cls, spec):
spec.inputs['metadata']['options']['resources'].default = {
'num_machines': 1,
'num_mpiprocs_per_machine': 1,
#'max_wallclock_seconds': 1800
}

#spec.input('metadata.options.max_wallclock_seconds', valid_type=Int, default=1800)
spec.input('metadata.options.max_wallclock_seconds', valid_type=int, default=1800)
spec.input('metadata.options.parser_name', valid_type=str, default='flexpart.cosmo')

# new ports
Expand Down
5 changes: 5 additions & 0 deletions aiida_flexpart/parsers/flexpart_cosmo.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ def parse(self, **kwargs):
files_retrieved, files_expected))
return self.exit_codes.ERROR_MISSING_OUTPUT_FILES

# check aiida.out content
with self.retrieved.open(output_filename, 'r') as handle:
content=handle.read()
if 'CONGRATULATIONS' not in content:
return ExitCode(1)
# add output file
self.logger.info("Parsing '{}'".format(output_filename))
with self.retrieved.open(output_filename, 'rb') as handle:
Expand Down
16 changes: 6 additions & 10 deletions aiida_flexpart/workflows/multi_dates_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""Flexpart multi-dates WorkChain."""
from aiida import engine, plugins, orm
from aiida_shell import launch_shell_job
from aiida.engine import calcfunction, while_
from aiida.engine import calcfunction, while_, if_
import datetime

FlexpartCalculation = plugins.CalculationFactory('flexpart.cosmo')
Expand Down Expand Up @@ -77,8 +77,9 @@ def define(cls, spec):
spec.outline(
cls.setup,
while_(cls.condition)(
cls.prepare_meteo_folder,
cls.run_simulation,
if_(cls.prepare_meteo_folder)(
cls.run_simulation
)
),
cls.results,
)
Expand Down Expand Up @@ -124,13 +125,8 @@ def prepare_meteo_folder(self):
'gribdir': self.inputs.gribdir,
'model': self.inputs.model
})

if node.is_finished_ok:
self.report(f'meteo files ready')
""" return True
else:
self.report('preparing meteo files failed. Terminating workflow.')
return False"""

return node.is_finished_ok

def run_simulation(self):
"""Run calculations for equation of state."""
Expand Down

0 comments on commit 976e7a0

Please sign in to comment.