gem/oq-engine — pull request #859 by arbeit (2012-08-31 08:13:03+00:00)
Title: Backported progress reporting to the master branch

Good morning!

The branch at hand (`backport-pr-2`) is bringing progress reporting to the hazard calculators in the master branch. That includes the following calculators:

- classical
- disaggregation
- event-based
- scenario

In order to be used in all the settings above the `count_progress()` decorator (more specifically its get_task_data() method) had to be enhanced to work with tasks that are passed positional parameters and/or keyword parameters.

Other than that a number of calculator-specific initialize_pr_data() implementations that define the total amount of work were added.

The new `count_progress()` decorator now copes with task invocations that use either positional or keyword parameters or a mix of these.

If the task's data parameter (e.g. `sites`) is passed in keyword fashion its name needs to be made known to the decorator (`data_arg="sites"`) so it can be found.

Also passing the data parameter in keyword fashion overrides the convention that the 2nd positional parameter is the task's data parameter (e.g. in the case of `compute_disagg_matrix_task()`)

If any or all of this sounds confusing just look at the code and ask questions on irc :-)

Last but not least I apologise for the size of this branch but please bear in mind that it adds progress report to 4 calculators and that it needs to land today so OpenQuake users can enjoy the benefit of this feature in the packaged version that is due next week.