Skip to content

Commit

Permalink
Merge pull request #222 from amoodie/nooutput_noerror
Browse files Browse the repository at this point in the history
fix error thrown to log during finalize when no output exists.
  • Loading branch information
amoodie authored Aug 6, 2021
2 parents d2fa57f + 6c72904 commit d626781
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/source/guides/advanced_configuration_guide.inc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Each folder will contain a copy of the configuration file used for that job; for
h0: 1.0
f_bedload: 0.5

Additionally, a log file for each job is located in the output folder, and any output grid files or images specified by the input configuration will be located in the respective job output folder.
Additionally, a log file for each job is located in the output folder, and any output grid files or images specified by the input configuration will be located in the respective job output folder (note: there is no output NetCDF4 file for these runs).

.. note:: You must specify the `out_dir` key in the input YAML configuration to use matrix expansion.

Expand Down
2 changes: 2 additions & 0 deletions pyDeltaRCM/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ def finalize(self):
self.output_netcdf.close()
_msg = 'Closed output NetCDF4 file'
self.log_info(_msg, verbosity=1)
except AttributeError:
self.log_info('No output NetCDF4 file to close.')
except Exception as e:
self.logger.error('Failed to close output NetCDF4 file')
self.logger.exception(e)
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_timing_triggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def test_finalize_updated(self, tmp_path):

# assert calls
# should only hit top-levels
assert _delta.log_info.call_count == 1
assert _delta.log_info.call_count == 2
assert _delta.output_data.call_count == 0
assert _delta.output_checkpoint.call_count == 0

Expand Down
2 changes: 1 addition & 1 deletion tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def test_finalize_not_updated(self, tmp_path):

# assert calls
# should hit all options since no saves
assert _delta.log_info.call_count == 1
assert _delta.log_info.call_count == 2

# these were originally included in `finalize`, but no longer.
# the checks for no call are here to ensure we don't revert
Expand Down

0 comments on commit d626781

Please sign in to comment.