Risk calculators refactoring

Bug #1175702 reported by matley
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenQuake Engine
Fix Released
Critical
matley

Bug Description

With the current implementation of risk calculators we have a relevant issue.

It is not easy to implement unit tests. The main reason is because the "units" of the calculators assume that a complete environment has been setup (an hazard job/calculation and a risk job/calculation).

Mocking is not always a viable option (with this implementation) as you often need to mock all the ORM machinery.

Moreover, test execution is a kind of epic, because of the extra computation, as well as disk writing, needed to run a single "unit".

Furthermore, the current celery task accepts too many parameters, making difficult to test every combination of the inputs.

We need to refactor them, such that:

1) reading/writing from the db is separated in specific modules/functions
2) the new units can be tested with a tiny setup (involving few mock objects)
3) the new units have a better function signature (less input params, few output values)

matley (matley)
description: updated
Revision history for this message
matley (matley) wrote :
description: updated
matley (matley)
Changed in oq-engine:
importance: Undecided → Critical
status: In Progress → Fix Committed
Changed in oq-engine:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.