force-h2020 / force-bdss

Business Decision System general interface
BSD 2-Clause "Simplified" License
2 stars 2 forks source link

port listeners into BaseOperation #320

Closed sparsonslab closed 4 years ago

sparsonslab commented 4 years ago

Closes #319. Put listener attributes and methods into BaseOperation and tests of these into new test_base_operation.py.

codecov[bot] commented 4 years ago

Codecov Report

Merging #320 into master will increase coverage by 0.00%. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #320   +/-   ##
=======================================
  Coverage   98.21%   98.21%           
=======================================
  Files          60       60           
  Lines        1677     1684    +7     
  Branches      170      170           
=======================================
+ Hits         1647     1654    +7     
  Misses         25       25           
  Partials        5        5           
Impacted Files Coverage Δ
force_bdss/app/base_operation.py 100.00% <100.00%> (ø)
force_bdss/app/evaluate_operation.py 100.00% <100.00%> (ø)
force_bdss/app/optimize_operation.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b740a3e...52c0cbc. Read the comment docs.

sparsonslab commented 4 years ago

For line 43 of evaluate_operation , kpi_results = self.workflow.execute(mco_data_values) should we put it in a try-except-finally statement like for mco.run(self.workflow) in the optimize operation? I tried this, but then the tests were complaining and I couldn't work out what to do.

flongford commented 4 years ago

For line 43 of evaluate_operation , kpi_results = self.workflow.execute(mco_data_values) should we put it in a try-except-finally statement like for mco.run(self.workflow) in the optimize operation? I tried this, but then the tests were complaining and I couldn't work out what to do.

That's a good idea, although I think actually this line should be fine if we verify the workflow first (#317), since then the only code that may fail during runtime would just involve the mco_communicator instance. In which case it's probably best to put the whole section from line 41-44 in a try-except-finally statement.

The unit tests might complain if log messages are added, so have a go removing the exception logging first. If keeps failing, then it's still ok to push any updates you've made so I can inspect the traceback on the Travis machine.