force-h2020 / force-bdss

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

FIX: Suggested try-except-finally implementation for EvaluateOperation run #322

Closed flongford closed 4 years ago

flongford commented 4 years ago

This is a suggestion for #320 of how to implement the try statement around any mco_communicator functions.

Since it is up to developers to implement both mco_communicator.recieve_from_mco and mco_communicator.send_to_mco, we include them in a try-except-finally block, to ensure that the threading events and listener instances are correctly finalised in the event of any exception being raised.

At the same time, since there are multiple origins of any exceptions (ie. lines 42, 43 and 44), we can avoid editing the logged traceback, and simply propagate the error message; our main aim is to make sure the code in the finally block will always be performed.

codecov[bot] commented 4 years ago

Codecov Report

Merging #322 into base-operation-listeners will not change coverage by %. The diff coverage is 100.00%.

Impacted file tree graph

@@                    Coverage Diff                    @@
##           base-operation-listeners     #322   +/-   ##
=========================================================
  Coverage                     98.21%   98.21%           
=========================================================
  Files                            60       60           
  Lines                          1684     1684           
  Branches                        170      170           
=========================================================
  Hits                           1654     1654           
  Misses                           25       25           
  Partials                          5        5           
Impacted Files Coverage Δ
force_bdss/app/evaluate_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 e488c3b...63a3393. Read the comment docs.