Changes to the event based task generation

This pull request supersedes https://github.com/gem/oq-engine/pull/1283

In addition to the changes there, it also exchange the way the arguments are generated in the event based calculator. Before we had a loop

for rlz in realizations:
    for src in sources:
          for ses in all_ses:
                yield ...

now we have

for rlz in realizations:
    for ses in all_ses:
          for src in sources:
                yield ...

The goal is to have tasks containing a lot of different sources which parallelize better.

I am running on the cluster the complete Japan calculation, the biggest one we have, at the limit of our capability to stress test the calculator. All the tests are green, see http://ci.openquake.org/job/zdevel_oq-engine/141/