Skip to content

Commit

Permalink
Metgrid records the output files.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas Barton committed Nov 1, 2017
1 parent 4a61148 commit e18a4d9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/wrf_runner/metgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def log_progress(current_domain, max_domains):
log_file=log_file
)

self.output_files = []

def __str__(self):
if self.state_machine.current_domain == 0:
return 'Metgrid (not running)'
Expand Down Expand Up @@ -75,8 +77,18 @@ async def run(self):

# Wait for the program to end
return_code = await self.program.run()

self.logger.info(f'Files created: {self.program.new_files}')

finally:
os.chdir(cwd)

# Evaluate the result
return self.state_machine.state == 'done' and return_code == 0
successful_run = self.state_machine.state == 'done' and return_code == 0

if successful_run:
self.output_files = [
f for f in self.program.new_files if f.endswith('.nc')]
self.logger.info(f'Output files: {self.output_files}')

return successful_run

0 comments on commit e18a4d9

Please sign in to comment.